@insmind/cli 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,7 @@ export function createCreativeAgentAdapter(dependencies) {
|
|
|
22
22
|
await observe?.({ submissionStarted: true });
|
|
23
23
|
const startedAt = Date.now();
|
|
24
24
|
let httpStatus;
|
|
25
|
-
const
|
|
25
|
+
const streamed = await dependencies.transport.postStream({
|
|
26
26
|
path: "/ai-agent/v1/thread/completion",
|
|
27
27
|
sensitiveResponse: true,
|
|
28
28
|
...(observe ? { onDispatch: (dispatchedAt) => observe({ dispatchedAt }) } : {}),
|
|
@@ -32,15 +32,16 @@ export function createCreativeAgentAdapter(dependencies) {
|
|
|
32
32
|
credential: access.credential,
|
|
33
33
|
organizationId: access.organizationId,
|
|
34
34
|
signal
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
}, async (stream) => {
|
|
36
|
+
await observe?.({ accepted: true });
|
|
37
|
+
return parseCreativeStream(stream, signal, async (contextId) => {
|
|
38
|
+
correlation.agentContextId = contextId;
|
|
39
|
+
dependencies.telemetry.annotate({ diagnostic_summary: { agentContextId: contextId } });
|
|
40
|
+
await observe?.({ contextId });
|
|
41
|
+
}, {
|
|
42
|
+
startedAt, ...(httpStatus === undefined ? {} : { httpStatus }),
|
|
43
|
+
onDiagnostics: diagnostic_summary => dependencies.telemetry.annotate({ diagnostic_summary })
|
|
44
|
+
});
|
|
44
45
|
});
|
|
45
46
|
const contextId = creativeContextId(streamed);
|
|
46
47
|
dependencies.telemetry.annotate({ diagnostic_summary: { agentContextId: contextId } });
|
|
@@ -230,7 +230,7 @@ export function createSignedHttpTransport(options) {
|
|
|
230
230
|
async putJson(request) {
|
|
231
231
|
return json(await send("PUT", request, "application/json", JSON.stringify(request.body), true));
|
|
232
232
|
},
|
|
233
|
-
async postStream(request) {
|
|
233
|
+
async postStream(request, consume) {
|
|
234
234
|
const received = await send("POST", request, request.accept, JSON.stringify(request.body), false);
|
|
235
235
|
const { response } = received;
|
|
236
236
|
if (!response.ok) {
|
|
@@ -242,7 +242,15 @@ export function createSignedHttpTransport(options) {
|
|
|
242
242
|
}
|
|
243
243
|
if (!response.body)
|
|
244
244
|
throw new RemoteRequestError(response.status, false, {}, undefined, "RESPONSE_BODY_MISSING", received.diagnostics());
|
|
245
|
-
|
|
245
|
+
try {
|
|
246
|
+
return await consume(response.body);
|
|
247
|
+
}
|
|
248
|
+
finally {
|
|
249
|
+
// Keep Response reachable across consumer awaits: Undici otherwise may
|
|
250
|
+
// GC-cancel an unread body before its reader is acquired. Also close an
|
|
251
|
+
// unread body when the consumer exits early; cleanup cannot mask it or hang.
|
|
252
|
+
void response.body.cancel().catch(() => undefined);
|
|
253
|
+
}
|
|
246
254
|
}
|
|
247
255
|
};
|
|
248
256
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insmind/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "insMind command-line interface for agents and people.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@gaoding/cli": "workspace:*"
|
|
48
48
|
},
|
|
49
49
|
"gaodingRelease": {
|
|
50
|
-
"sourceCommit": "
|
|
51
|
-
"pipelineId": "
|
|
52
|
-
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/
|
|
50
|
+
"sourceCommit": "dd07bc1432494f88eaa2d3a0976e6415cda8bc1b",
|
|
51
|
+
"pipelineId": "259288",
|
|
52
|
+
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/259288"
|
|
53
53
|
}
|
|
54
54
|
}
|