mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 02:15:36 +00:00
fix(glmt): emit thinking signature as opaque string
generateThinkingSignature() returned an object
({type, hash, length, timestamp}) but Anthropic requires a thinking
block's `signature` to be a non-empty opaque STRING. The object made
the thinking block invalid, breaking the stream against reasoning
backends and surfacing as a false 502 "did not respond within 600s".
Return a deterministic base64 token instead (no Date.now()), and
narrow ThinkingSignature to a string alias so existing imports stay
intact. The signature is only ever assigned, never read as an object,
so consumers are unaffected. Update the existing unit test to the
corrected string contract.
Built [OnSteroids](https://onsteroids.ai)
This commit is contained in:
1 parent
37d2bae001
commit
cbcdb6ba62
3 files changed
+17
-20
No files matched your search
@@ -161,16 +161,17 @@ describe('GlmtTransformer', () => {
|
||||
});
|
||||
|
||||
describe('Thinking signature', () => {
|
||||
it('generates thinking signature', () => {
|
||||
it('generates thinking signature as a non-empty opaque string', () => {
|
||||
const transformer = new GlmtTransformer();
|
||||
const thinking = 'This is my reasoning process';
|
||||
const signature = transformer.generateThinkingSignature(thinking);
|
||||
|
||||
assert.strictEqual(signature.type, 'thinking_signature');
|
||||
assert.ok(signature.hash);
|
||||
assert.strictEqual(signature.hash.length, 16);
|
||||
assert.strictEqual(signature.length, thinking.length);
|
||||
assert.ok(signature.timestamp);
|
||||
// Anthropic contract: a thinking block's signature is a non-empty
|
||||
// opaque string, not an object.
|
||||
assert.strictEqual(typeof signature, 'string');
|
||||
assert.ok(signature.length > 0);
|
||||
// Deterministic: same reasoning yields the same signature (no Date.now()).
|
||||
assert.strictEqual(signature, transformer.generateThinkingSignature(thinking));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user