@stigmer/sdk 3.12.5 → 3.12.7
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.
- package/__tests__/update-input-roundtrip.test.d.ts +2 -0
- package/__tests__/update-input-roundtrip.test.d.ts.map +1 -0
- package/__tests__/update-input-roundtrip.test.js +795 -0
- package/__tests__/update-input-roundtrip.test.js.map +1 -0
- package/__tests__/update-input.test.js +22 -3
- package/__tests__/update-input.test.js.map +1 -1
- package/execution/__tests__/transcript.test.d.ts +2 -0
- package/execution/__tests__/transcript.test.d.ts.map +1 -0
- package/execution/__tests__/transcript.test.js +527 -0
- package/execution/__tests__/transcript.test.js.map +1 -0
- package/execution/conversation-rules.d.ts +64 -0
- package/execution/conversation-rules.d.ts.map +1 -0
- package/execution/conversation-rules.js +113 -0
- package/execution/conversation-rules.js.map +1 -0
- package/execution/transcript.d.ts +171 -0
- package/execution/transcript.d.ts.map +1 -0
- package/execution/transcript.js +484 -0
- package/execution/transcript.js.map +1 -0
- package/gen/agent.d.ts +21 -0
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +73 -1
- package/gen/agent.js.map +1 -1
- package/gen/agentchannel.d.ts +23 -1
- package/gen/agentchannel.d.ts.map +1 -1
- package/gen/agentchannel.js +55 -1
- package/gen/agentchannel.js.map +1 -1
- package/gen/agentexecution.d.ts +34 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +176 -2
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts +21 -0
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js +32 -1
- package/gen/agentinstance.js.map +1 -1
- package/gen/agentshare.d.ts +23 -1
- package/gen/agentshare.d.ts.map +1 -1
- package/gen/agentshare.js +53 -1
- package/gen/agentshare.js.map +1 -1
- package/gen/apikey.d.ts +21 -0
- package/gen/apikey.d.ts.map +1 -1
- package/gen/apikey.js +33 -1
- package/gen/apikey.js.map +1 -1
- package/gen/artifact.d.ts +8 -0
- package/gen/artifact.d.ts.map +1 -1
- package/gen/artifact.js +1 -0
- package/gen/artifact.js.map +1 -1
- package/gen/channelapp.d.ts +21 -0
- package/gen/channelapp.d.ts.map +1 -1
- package/gen/channelapp.js +45 -0
- package/gen/channelapp.js.map +1 -1
- package/gen/client.d.ts +5 -1
- package/gen/client.d.ts.map +1 -1
- package/gen/client.js +4 -0
- package/gen/client.js.map +1 -1
- package/gen/environment.d.ts +21 -0
- package/gen/environment.d.ts.map +1 -1
- package/gen/environment.js +31 -1
- package/gen/environment.js.map +1 -1
- package/gen/executioncontext.d.ts +8 -0
- package/gen/executioncontext.d.ts.map +1 -1
- package/gen/executioncontext.js +1 -0
- package/gen/executioncontext.js.map +1 -1
- package/gen/iampolicy.d.ts +8 -0
- package/gen/iampolicy.d.ts.map +1 -1
- package/gen/iampolicy.js +1 -0
- package/gen/iampolicy.js.map +1 -1
- package/gen/identityaccount.d.ts +22 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +48 -1
- package/gen/identityaccount.js.map +1 -1
- package/gen/identityprovider.d.ts +21 -0
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js +40 -0
- package/gen/identityprovider.js.map +1 -1
- package/gen/invitation.d.ts +8 -0
- package/gen/invitation.d.ts.map +1 -1
- package/gen/invitation.js +1 -0
- package/gen/invitation.js.map +1 -1
- package/gen/mcpserver.d.ts +21 -0
- package/gen/mcpserver.d.ts.map +1 -1
- package/gen/mcpserver.js +79 -1
- package/gen/mcpserver.js.map +1 -1
- package/gen/memory.d.ts +58 -0
- package/gen/memory.d.ts.map +1 -0
- package/gen/memory.js +143 -0
- package/gen/memory.js.map +1 -0
- package/gen/oauthapp.d.ts +21 -0
- package/gen/oauthapp.d.ts.map +1 -1
- package/gen/oauthapp.js +39 -0
- package/gen/oauthapp.js.map +1 -1
- package/gen/organization.d.ts +22 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +43 -1
- package/gen/organization.js.map +1 -1
- package/gen/platformclient.d.ts +21 -0
- package/gen/platformclient.d.ts.map +1 -1
- package/gen/platformclient.js +40 -1
- package/gen/platformclient.js.map +1 -1
- package/gen/project.d.ts +21 -0
- package/gen/project.d.ts.map +1 -1
- package/gen/project.js +32 -1
- package/gen/project.js.map +1 -1
- package/gen/proto-utils.d.ts +36 -0
- package/gen/proto-utils.d.ts.map +1 -1
- package/gen/proto-utils.js +58 -0
- package/gen/proto-utils.js.map +1 -1
- package/gen/schedule.d.ts +23 -1
- package/gen/schedule.d.ts.map +1 -1
- package/gen/schedule.js +79 -1
- package/gen/schedule.js.map +1 -1
- package/gen/session.d.ts +21 -0
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js +80 -1
- package/gen/session.js.map +1 -1
- package/gen/skill.d.ts +8 -0
- package/gen/skill.d.ts.map +1 -1
- package/gen/skill.js +1 -0
- package/gen/skill.js.map +1 -1
- package/gen/workflow.d.ts +21 -0
- package/gen/workflow.d.ts.map +1 -1
- package/gen/workflow.js +79 -0
- package/gen/workflow.js.map +1 -1
- package/gen/workflowexecution.d.ts +21 -0
- package/gen/workflowexecution.d.ts.map +1 -1
- package/gen/workflowexecution.js +36 -1
- package/gen/workflowexecution.js.map +1 -1
- package/gen/workflowinstance.d.ts +21 -0
- package/gen/workflowinstance.d.ts.map +1 -1
- package/gen/workflowinstance.js +33 -1
- package/gen/workflowinstance.js.map +1 -1
- package/index.d.ts +23 -21
- package/index.d.ts.map +1 -1
- package/index.js +27 -23
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/update-input-roundtrip.test.ts +1035 -0
- package/src/__tests__/update-input.test.ts +34 -3
- package/src/execution/__tests__/transcript.golden.md +100 -0
- package/src/execution/__tests__/transcript.test.ts +627 -0
- package/src/execution/conversation-rules.ts +119 -0
- package/src/execution/transcript.ts +735 -0
- package/src/gen/agent.ts +89 -3
- package/src/gen/agentchannel.ts +72 -4
- package/src/gen/agentexecution.ts +216 -6
- package/src/gen/agentinstance.ts +41 -1
- package/src/gen/agentshare.ts +68 -4
- package/src/gen/apikey.ts +42 -1
- package/src/gen/artifact.ts +9 -0
- package/src/gen/channelapp.ts +57 -1
- package/src/gen/client.ts +6 -1
- package/src/gen/environment.ts +40 -1
- package/src/gen/executioncontext.ts +9 -0
- package/src/gen/iampolicy.ts +9 -0
- package/src/gen/identityaccount.ts +60 -2
- package/src/gen/identityprovider.ts +49 -0
- package/src/gen/invitation.ts +9 -0
- package/src/gen/mcpserver.ts +95 -3
- package/src/gen/memory.ts +164 -0
- package/src/gen/oauthapp.ts +48 -0
- package/src/gen/organization.ts +55 -2
- package/src/gen/platformclient.ts +49 -1
- package/src/gen/project.ts +41 -1
- package/src/gen/proto-utils.ts +64 -0
- package/src/gen/schedule.ts +98 -4
- package/src/gen/session.ts +97 -3
- package/src/gen/skill.ts +9 -0
- package/src/gen/workflow.ts +96 -2
- package/src/gen/workflowexecution.ts +45 -1
- package/src/gen/workflowinstance.ts +42 -1
- package/src/index.ts +52 -9
- package/src/update-input.ts +0 -168
- package/update-input.d.ts +0 -24
- package/update-input.d.ts.map +0 -1
- package/update-input.js +0 -126
- package/update-input.js.map +0 -1
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
// The canonical, full-fidelity session transcript (stigmer/stigmer#814).
|
|
2
|
+
//
|
|
3
|
+
// A session's whole conversation — thinking included, tool calls with their
|
|
4
|
+
// offloaded outputs resolved, sub-agent turns, timestamps — assembled ONCE
|
|
5
|
+
// here so every consumer (the SessionViewer export control, the CLI, an
|
|
6
|
+
// embedder's backend analysis job) reads the same authoritative record
|
|
7
|
+
// instead of re-deriving it.
|
|
8
|
+
//
|
|
9
|
+
// Canonical rules, decided for #814:
|
|
10
|
+
// - Fidelity beats noise suppression. Thinking and system messages are
|
|
11
|
+
// carried verbatim; presentation-layer cleanups (the CLI replay's
|
|
12
|
+
// system-error rewriting, approval-noise dropping) stay in the
|
|
13
|
+
// presentation layers. The transcript is raw material for improving
|
|
14
|
+
// agents — the judgment signal lives in exactly the parts a polished
|
|
15
|
+
// view hides.
|
|
16
|
+
// - Tool calls attach to their parent MESSAGE_AI message. Every tool call
|
|
17
|
+
// lives on an AI message in the data model, so this shows each call
|
|
18
|
+
// exactly once, in position. (The CLI replay's started_at interleaving
|
|
19
|
+
// is an event-stream presentation need, not a data rule.)
|
|
20
|
+
// - Superseded turns (edit-and-resubmit) are excluded by default, matching
|
|
21
|
+
// what the conversation view shows; `includeSuperseded: true` keeps them,
|
|
22
|
+
// marked, for the history-faithful variant.
|
|
23
|
+
// - An in-flight execution exports as its last-persisted snapshot and is
|
|
24
|
+
// marked `inProgress` — honest about what a mid-run export is.
|
|
25
|
+
// - Sub-agent transcripts (`status.sub_agent_executions` — task-tool
|
|
26
|
+
// delegations) are embedded in the parent's status and export in full. A
|
|
27
|
+
// `call-agent` workflow task spawns a SEPARATE child AgentExecution in
|
|
28
|
+
// its own session; that is a different session's transcript, not part of
|
|
29
|
+
// this one.
|
|
30
|
+
//
|
|
31
|
+
// Like the rest of this folder, the module is framework-free: the fetch
|
|
32
|
+
// entry point takes a structural client slice, so it runs in React hosts,
|
|
33
|
+
// Node jobs, and the CLI alike.
|
|
34
|
+
import { toJson } from "@bufbuild/protobuf";
|
|
35
|
+
import { create } from "@bufbuild/protobuf";
|
|
36
|
+
import { AgentExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
37
|
+
import { MessageType, ToolCallStatus, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
38
|
+
import { GetArtifactContentRequestSchema, ListAgentExecutionsBySessionRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
|
|
39
|
+
import { SessionSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
40
|
+
import { resolvedSubject } from "../session.js";
|
|
41
|
+
import { execIdFromStorageKey, isBuildFromPlanTurn, sortChronologically, supersededExecutionIds, syntheticUserPrompt, } from "./conversation-rules.js";
|
|
42
|
+
import { isTerminalPhase } from "./execution-phases.js";
|
|
43
|
+
/**
|
|
44
|
+
* Assembles the canonical transcript from a session and its executions.
|
|
45
|
+
*
|
|
46
|
+
* Pure — same inputs, same transcript. Ordering, superseded filtering, and
|
|
47
|
+
* user-turn synthesis are the shared conversation rules from
|
|
48
|
+
* `conversation-rules.ts`, so this cannot drift from what the conversation
|
|
49
|
+
* view renders.
|
|
50
|
+
*/
|
|
51
|
+
export function assembleSessionTranscript(session, executions, options) {
|
|
52
|
+
const includeSuperseded = options?.includeSuperseded === true;
|
|
53
|
+
const ordered = sortChronologically(executions);
|
|
54
|
+
const superseded = supersededExecutionIds(ordered);
|
|
55
|
+
const turns = [];
|
|
56
|
+
for (const execution of ordered) {
|
|
57
|
+
const isSuperseded = superseded.has(execution.metadata?.id ?? "");
|
|
58
|
+
if (isSuperseded && !includeSuperseded)
|
|
59
|
+
continue;
|
|
60
|
+
const phase = execution.status?.phase;
|
|
61
|
+
turns.push({
|
|
62
|
+
execution,
|
|
63
|
+
userPrompt: syntheticUserPrompt(execution),
|
|
64
|
+
isBuildFromPlan: isBuildFromPlanTurn(execution),
|
|
65
|
+
superseded: isSuperseded,
|
|
66
|
+
inProgress: phase === undefined || !isTerminalPhase(phase),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
session,
|
|
71
|
+
turns,
|
|
72
|
+
resolvedOutputs: options?.resolvedOutputs ?? {},
|
|
73
|
+
includesSuperseded: includeSuperseded,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Fetches everything a session's transcript needs and assembles it.
|
|
78
|
+
*
|
|
79
|
+
* One `listBySession` call returns the complete execution set — both server
|
|
80
|
+
* editions answer this RPC unpaginated today (Go: `TODO: Implement
|
|
81
|
+
* pagination`; Java: "not using pagination with authorized IDs approach").
|
|
82
|
+
* If a future server starts paginating (`total_pages > 1`), this fails with
|
|
83
|
+
* a descriptive error rather than silently exporting a truncated
|
|
84
|
+
* "full-fidelity" transcript.
|
|
85
|
+
*/
|
|
86
|
+
export async function fetchSessionTranscript(client, sessionId, options) {
|
|
87
|
+
const [session, list] = await Promise.all([
|
|
88
|
+
client.session.get(sessionId),
|
|
89
|
+
client.agentExecution.listBySession(create(ListAgentExecutionsBySessionRequestSchema, { sessionId })),
|
|
90
|
+
]);
|
|
91
|
+
if (list.totalPages > 1) {
|
|
92
|
+
throw new Error(`Session ${sessionId} has ${list.totalPages} pages of executions but ` +
|
|
93
|
+
"transcript export reads a single page. The server has started " +
|
|
94
|
+
"paginating listBySession; teach fetchSessionTranscript to walk " +
|
|
95
|
+
"pages before exporting, so no turns are silently dropped.");
|
|
96
|
+
}
|
|
97
|
+
const resolvedOutputs = options?.resolveOutputs === false
|
|
98
|
+
? {}
|
|
99
|
+
: await resolveOffloadedOutputs(client, list.entries, {
|
|
100
|
+
concurrency: options?.concurrency,
|
|
101
|
+
});
|
|
102
|
+
return assembleSessionTranscript(session, list.entries, {
|
|
103
|
+
includeSuperseded: options?.includeSuperseded,
|
|
104
|
+
resolvedOutputs,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fetches the content behind every offloaded tool output in the given
|
|
109
|
+
* executions (parent and sub-agent transcripts alike), keyed by storage key.
|
|
110
|
+
*
|
|
111
|
+
* Image refs are never fetched — serializers render them as notes. The
|
|
112
|
+
* execution id for each fetch derives from the storage key itself
|
|
113
|
+
* (`execIdFromStorageKey`): sub-agent outputs are stored under the PARENT
|
|
114
|
+
* execution's id, and the key is the record of that.
|
|
115
|
+
*/
|
|
116
|
+
export async function resolveOffloadedOutputs(client, executions, options) {
|
|
117
|
+
const refs = new Map();
|
|
118
|
+
for (const execution of executions) {
|
|
119
|
+
for (const toolCall of allToolCalls(execution.status)) {
|
|
120
|
+
const ref = toolCall.outputRef;
|
|
121
|
+
if (ref?.storageKey)
|
|
122
|
+
refs.set(ref.storageKey, ref);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const resolved = {};
|
|
126
|
+
const decoder = new TextDecoder("utf-8", { fatal: false });
|
|
127
|
+
await mapWithConcurrency([...refs.values()], options?.concurrency ?? 4, async (ref) => {
|
|
128
|
+
const base = {
|
|
129
|
+
storageKey: ref.storageKey,
|
|
130
|
+
mimeType: ref.mimeType,
|
|
131
|
+
isImage: ref.isImage,
|
|
132
|
+
totalSizeBytes: Number(ref.sizeBytes),
|
|
133
|
+
};
|
|
134
|
+
if (ref.isImage) {
|
|
135
|
+
resolved[ref.storageKey] = { ...base, truncated: false };
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const executionId = execIdFromStorageKey(ref.storageKey);
|
|
139
|
+
if (!executionId) {
|
|
140
|
+
resolved[ref.storageKey] = {
|
|
141
|
+
...base,
|
|
142
|
+
truncated: false,
|
|
143
|
+
error: `unexpected storage key shape: ${ref.storageKey}`,
|
|
144
|
+
};
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const response = await client.agentExecution.getArtifactContent(create(GetArtifactContentRequestSchema, {
|
|
149
|
+
executionId,
|
|
150
|
+
storageKey: ref.storageKey,
|
|
151
|
+
}));
|
|
152
|
+
resolved[ref.storageKey] = {
|
|
153
|
+
...base,
|
|
154
|
+
content: decoder.decode(response.content),
|
|
155
|
+
truncated: response.truncated,
|
|
156
|
+
totalSizeBytes: Number(response.totalSizeBytes),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
resolved[ref.storageKey] = {
|
|
161
|
+
...base,
|
|
162
|
+
truncated: false,
|
|
163
|
+
error: e instanceof Error ? e.message : String(e),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return resolved;
|
|
168
|
+
}
|
|
169
|
+
/** Every tool call in an execution's status — the parent transcript's plus
|
|
170
|
+
* each embedded sub-agent transcript's. */
|
|
171
|
+
function* allToolCalls(status) {
|
|
172
|
+
if (!status)
|
|
173
|
+
return;
|
|
174
|
+
const messageLists = [
|
|
175
|
+
status.messages,
|
|
176
|
+
...status.subAgentExecutions.map((sa) => sa.messages),
|
|
177
|
+
];
|
|
178
|
+
for (const messages of messageLists) {
|
|
179
|
+
for (const message of messages) {
|
|
180
|
+
yield* message.toolCalls;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/** Runs `fn` over `items` with at most `limit` in flight. */
|
|
185
|
+
async function mapWithConcurrency(items, limit, fn) {
|
|
186
|
+
let next = 0;
|
|
187
|
+
const workers = Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, async () => {
|
|
188
|
+
while (next < items.length) {
|
|
189
|
+
const item = items[next++];
|
|
190
|
+
await fn(item);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
await Promise.all(workers);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Renders the transcript as a self-contained Markdown document.
|
|
197
|
+
*
|
|
198
|
+
* Deterministic: same transcript, same bytes — the format is a pinned
|
|
199
|
+
* contract (see `__tests__/transcript.test.ts`). Roles are bold labels
|
|
200
|
+
* (User / Assistant / Thinking / System), thinking and system content is
|
|
201
|
+
* blockquoted, tool calls carry fenced args and output, and sub-agent turns
|
|
202
|
+
* are blockquoted sections. Fences self-size past any backtick runs in the
|
|
203
|
+
* content, so hostile content cannot break out of its block.
|
|
204
|
+
*/
|
|
205
|
+
export function transcriptToMarkdown(transcript, options) {
|
|
206
|
+
const { session, turns, resolvedOutputs } = transcript;
|
|
207
|
+
const out = [];
|
|
208
|
+
const sessionId = session.metadata?.id ?? "";
|
|
209
|
+
const title = resolvedSubject(session.spec?.subject) ?? `Session ${sessionId}`;
|
|
210
|
+
out.push(`# ${title}`, "");
|
|
211
|
+
out.push(`- Session: \`${sessionId}\``);
|
|
212
|
+
const agentInstanceId = session.spec?.agentInstanceId;
|
|
213
|
+
if (agentInstanceId)
|
|
214
|
+
out.push(`- Agent instance: \`${agentInstanceId}\``);
|
|
215
|
+
out.push(`- Turns: ${turns.length}`);
|
|
216
|
+
if (transcript.includesSuperseded) {
|
|
217
|
+
out.push("- Includes superseded (edited-and-resubmitted) turns");
|
|
218
|
+
}
|
|
219
|
+
if (options?.generatedAt)
|
|
220
|
+
out.push(`- Exported: ${options.generatedAt}`);
|
|
221
|
+
for (let i = 0; i < turns.length; i++) {
|
|
222
|
+
const turn = turns[i];
|
|
223
|
+
out.push("", "---", "");
|
|
224
|
+
out.push(`## Turn ${i + 1}${turnHeaderSuffix(turn)}`);
|
|
225
|
+
if (turn.superseded) {
|
|
226
|
+
out.push("", "_Superseded by an edited resubmission._");
|
|
227
|
+
}
|
|
228
|
+
if (turn.inProgress) {
|
|
229
|
+
out.push("", "_In progress at export time — content is the last persisted snapshot._");
|
|
230
|
+
}
|
|
231
|
+
if (turn.isBuildFromPlan) {
|
|
232
|
+
out.push("", "_Build from plan._");
|
|
233
|
+
}
|
|
234
|
+
if (turn.userPrompt !== null) {
|
|
235
|
+
out.push("", "**User**", "", turn.userPrompt);
|
|
236
|
+
}
|
|
237
|
+
renderMessages(out, turn.execution.status?.messages ?? [], turn.execution.status?.subAgentExecutions ?? [], resolvedOutputs, turn.userPrompt);
|
|
238
|
+
const error = turn.execution.status?.error;
|
|
239
|
+
if (error) {
|
|
240
|
+
out.push("", "**Execution error**", "", blockquote(error));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
out.push("");
|
|
244
|
+
return out.join("\n");
|
|
245
|
+
}
|
|
246
|
+
function turnHeaderSuffix(turn) {
|
|
247
|
+
const startedAt = turn.execution.status?.startedAt;
|
|
248
|
+
return startedAt ? ` · ${startedAt}` : "";
|
|
249
|
+
}
|
|
250
|
+
/** Renders one message list — the parent turn's or a sub-agent's. */
|
|
251
|
+
function renderMessages(out, messages, subAgents, resolvedOutputs, userPrompt) {
|
|
252
|
+
for (const message of messages) {
|
|
253
|
+
switch (message.type) {
|
|
254
|
+
case MessageType.MESSAGE_TOOL:
|
|
255
|
+
// Tool calls render from their parent MESSAGE_AI's tool_calls (the
|
|
256
|
+
// canonical attach rule); the MESSAGE_TOOL echo would double them.
|
|
257
|
+
continue;
|
|
258
|
+
case MessageType.MESSAGE_HUMAN: {
|
|
259
|
+
// The turn's opening prompt is already rendered from spec.message;
|
|
260
|
+
// skip its status.messages echo. Any OTHER human message is kept.
|
|
261
|
+
if (userPrompt !== null && message.content === userPrompt)
|
|
262
|
+
continue;
|
|
263
|
+
out.push("", "**User**", "", message.content);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
case MessageType.MESSAGE_THINKING:
|
|
267
|
+
out.push("", "**Thinking**", "", blockquote(message.content));
|
|
268
|
+
continue;
|
|
269
|
+
case MessageType.MESSAGE_SYSTEM:
|
|
270
|
+
out.push("", "**System**", "", blockquote(message.content));
|
|
271
|
+
continue;
|
|
272
|
+
case MessageType.MESSAGE_AI: {
|
|
273
|
+
if (message.content.trim()) {
|
|
274
|
+
out.push("", "**Assistant**", "", message.content);
|
|
275
|
+
}
|
|
276
|
+
for (const toolCall of message.toolCalls) {
|
|
277
|
+
if (toolCall.name === "task") {
|
|
278
|
+
const subAgent = subAgents.find((sa) => sa.id === toolCall.id);
|
|
279
|
+
if (subAgent) {
|
|
280
|
+
renderSubAgent(out, subAgent, resolvedOutputs);
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
renderToolCall(out, toolCall, resolvedOutputs);
|
|
285
|
+
}
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
default:
|
|
289
|
+
// Unknown future message type: carry the content rather than drop it.
|
|
290
|
+
if (message.content)
|
|
291
|
+
out.push("", blockquote(message.content));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function renderToolCall(out, toolCall, resolvedOutputs) {
|
|
296
|
+
out.push("", `**Tool — \`${toolCall.name}\`**${toolCallSuffix(toolCall)}`);
|
|
297
|
+
// ToolCall.args is a google.protobuf.Struct, which protobuf-es represents
|
|
298
|
+
// as a plain JsonObject — safe to stringify directly (no bigint fields).
|
|
299
|
+
const args = toolCall.args
|
|
300
|
+
? JSON.stringify(toolCall.args, null, 2)
|
|
301
|
+
: undefined;
|
|
302
|
+
if (args && args !== "{}") {
|
|
303
|
+
out.push("", fenced(args, "json"));
|
|
304
|
+
}
|
|
305
|
+
const output = toolOutputText(toolCall, resolvedOutputs);
|
|
306
|
+
if (output.note)
|
|
307
|
+
out.push("", `_${output.note}_`);
|
|
308
|
+
if (output.text)
|
|
309
|
+
out.push("", fenced(output.text));
|
|
310
|
+
if (toolCall.error) {
|
|
311
|
+
out.push("", "Error:", "", fenced(toolCall.error));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/** The output text and honesty note for a tool call, applying the
|
|
315
|
+
* offload-resolution fallbacks. */
|
|
316
|
+
function toolOutputText(toolCall, resolvedOutputs) {
|
|
317
|
+
const ref = toolCall.outputRef;
|
|
318
|
+
if (!ref?.storageKey) {
|
|
319
|
+
return toolCall.result ? { text: toolCall.result } : {};
|
|
320
|
+
}
|
|
321
|
+
if (ref.isImage) {
|
|
322
|
+
return {
|
|
323
|
+
note: `Image output (${ref.mimeType || "image"}, ${Number(ref.sizeBytes)} bytes) — not inlined.`,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const resolved = resolvedOutputs[ref.storageKey];
|
|
327
|
+
if (resolved?.content !== undefined) {
|
|
328
|
+
return {
|
|
329
|
+
text: resolved.content,
|
|
330
|
+
note: resolved.truncated
|
|
331
|
+
? `Output truncated at ${resolved.content.length} of ${resolved.totalSizeBytes} bytes (server content cap).`
|
|
332
|
+
: undefined,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
text: ref.truncatedPreview || toolCall.result || undefined,
|
|
337
|
+
note: resolved?.error
|
|
338
|
+
? `Offloaded output unavailable (${resolved.error}) — showing preview.`
|
|
339
|
+
: "Offloaded output not resolved — showing preview.",
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function toolCallSuffix(toolCall) {
|
|
343
|
+
const parts = [];
|
|
344
|
+
const status = toolCallStatusLabel(toolCall.status);
|
|
345
|
+
if (status)
|
|
346
|
+
parts.push(status);
|
|
347
|
+
const duration = formatDuration(toolCall.startedAt, toolCall.completedAt);
|
|
348
|
+
if (duration)
|
|
349
|
+
parts.push(duration);
|
|
350
|
+
return parts.length > 0 ? ` (${parts.join(" · ")})` : "";
|
|
351
|
+
}
|
|
352
|
+
function toolCallStatusLabel(status) {
|
|
353
|
+
switch (status) {
|
|
354
|
+
case ToolCallStatus.TOOL_CALL_COMPLETED:
|
|
355
|
+
return "completed";
|
|
356
|
+
case ToolCallStatus.TOOL_CALL_FAILED:
|
|
357
|
+
return "failed";
|
|
358
|
+
case ToolCallStatus.TOOL_CALL_SKIPPED:
|
|
359
|
+
return "skipped";
|
|
360
|
+
case ToolCallStatus.TOOL_CALL_INTERRUPTED:
|
|
361
|
+
return "interrupted";
|
|
362
|
+
case ToolCallStatus.TOOL_CALL_RUNNING:
|
|
363
|
+
return "running";
|
|
364
|
+
case ToolCallStatus.TOOL_CALL_WAITING_APPROVAL:
|
|
365
|
+
return "waiting for approval";
|
|
366
|
+
case ToolCallStatus.TOOL_CALL_PENDING:
|
|
367
|
+
return "pending";
|
|
368
|
+
default:
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function renderSubAgent(out, subAgent, resolvedOutputs) {
|
|
373
|
+
const nested = [];
|
|
374
|
+
const title = subAgent.subject || subAgent.name || "sub-agent";
|
|
375
|
+
nested.push(`**Sub-agent — ${title}**${subAgentSuffix(subAgent)}`);
|
|
376
|
+
if (subAgent.input) {
|
|
377
|
+
nested.push("", "Input:", "", subAgent.input);
|
|
378
|
+
}
|
|
379
|
+
renderMessages(nested, subAgent.messages, [], resolvedOutputs, null);
|
|
380
|
+
if (subAgent.output) {
|
|
381
|
+
nested.push("", "Output:", "", subAgent.output);
|
|
382
|
+
}
|
|
383
|
+
if (subAgent.error) {
|
|
384
|
+
nested.push("", "Error:", "", fenced(subAgent.error));
|
|
385
|
+
}
|
|
386
|
+
out.push("", blockquote(nested.join("\n")));
|
|
387
|
+
}
|
|
388
|
+
function subAgentSuffix(subAgent) {
|
|
389
|
+
const duration = formatDuration(subAgent.startedAt, subAgent.completedAt);
|
|
390
|
+
return duration ? ` (${duration})` : "";
|
|
391
|
+
}
|
|
392
|
+
/** `"3.2s"` when both ISO timestamps parse and are ordered, else `null`. */
|
|
393
|
+
function formatDuration(startedAt, completedAt) {
|
|
394
|
+
if (!startedAt || !completedAt)
|
|
395
|
+
return null;
|
|
396
|
+
const start = Date.parse(startedAt);
|
|
397
|
+
const end = Date.parse(completedAt);
|
|
398
|
+
if (Number.isNaN(start) || Number.isNaN(end) || end < start)
|
|
399
|
+
return null;
|
|
400
|
+
const ms = end - start;
|
|
401
|
+
if (ms < 1000)
|
|
402
|
+
return `${ms}ms`;
|
|
403
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
404
|
+
}
|
|
405
|
+
/** Prefixes every line with `> ` (blockquote), including blank lines. */
|
|
406
|
+
function blockquote(text) {
|
|
407
|
+
return text
|
|
408
|
+
.split("\n")
|
|
409
|
+
.map((line) => (line.length > 0 ? `> ${line}` : ">"))
|
|
410
|
+
.join("\n");
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Wraps content in a code fence sized past its longest backtick run, so
|
|
414
|
+
* content containing ``` can never terminate the block early.
|
|
415
|
+
*/
|
|
416
|
+
function fenced(content, language = "") {
|
|
417
|
+
let longest = 0;
|
|
418
|
+
for (const match of content.matchAll(/`+/g)) {
|
|
419
|
+
if (match[0].length > longest)
|
|
420
|
+
longest = match[0].length;
|
|
421
|
+
}
|
|
422
|
+
const fence = "`".repeat(Math.max(3, longest + 1));
|
|
423
|
+
return `${fence}${language}\n${content}\n${fence}`;
|
|
424
|
+
}
|
|
425
|
+
// ============================================================================
|
|
426
|
+
// JSON serialization
|
|
427
|
+
// ============================================================================
|
|
428
|
+
/**
|
|
429
|
+
* Renders the transcript as a plain JSON value for programmatic analysis.
|
|
430
|
+
*
|
|
431
|
+
* Proto parts serialize through `toJson` with `useProtoFieldName: true` —
|
|
432
|
+
* the platform-wide protojson parity contract (snake_case fields, int64 as
|
|
433
|
+
* strings, `fromJson` round-trippable). Never `JSON.stringify` a raw proto
|
|
434
|
+
* object here: int64 fields are `bigint` and would throw.
|
|
435
|
+
*
|
|
436
|
+
* One deliberate omission: `status.callback_token` is stripped. It is an
|
|
437
|
+
* internal Temporal task token (runtime plumbing for workflow-triggered
|
|
438
|
+
* executions), not conversation material, and has no place in a document
|
|
439
|
+
* users share and paste around.
|
|
440
|
+
*/
|
|
441
|
+
export function transcriptToJson(transcript) {
|
|
442
|
+
const turns = transcript.turns.map((turn) => {
|
|
443
|
+
const execution = toJson(AgentExecutionSchema, turn.execution, {
|
|
444
|
+
useProtoFieldName: true,
|
|
445
|
+
});
|
|
446
|
+
if (execution !== null &&
|
|
447
|
+
typeof execution === "object" &&
|
|
448
|
+
!Array.isArray(execution)) {
|
|
449
|
+
const status = execution["status"];
|
|
450
|
+
if (status !== null && typeof status === "object" && !Array.isArray(status)) {
|
|
451
|
+
delete status["callback_token"];
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
user_prompt: turn.userPrompt,
|
|
456
|
+
build_from_plan: turn.isBuildFromPlan || undefined,
|
|
457
|
+
superseded: turn.superseded || undefined,
|
|
458
|
+
in_progress: turn.inProgress || undefined,
|
|
459
|
+
execution,
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
const resolvedOutputs = {};
|
|
463
|
+
for (const [key, output] of Object.entries(transcript.resolvedOutputs)) {
|
|
464
|
+
resolvedOutputs[key] = {
|
|
465
|
+
storage_key: output.storageKey,
|
|
466
|
+
content: output.content,
|
|
467
|
+
truncated: output.truncated || undefined,
|
|
468
|
+
total_size_bytes: output.totalSizeBytes,
|
|
469
|
+
mime_type: output.mimeType,
|
|
470
|
+
is_image: output.isImage || undefined,
|
|
471
|
+
error: output.error,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
format: "stigmer.ai/session-transcript/v1",
|
|
476
|
+
session: toJson(SessionSchema, transcript.session, {
|
|
477
|
+
useProtoFieldName: true,
|
|
478
|
+
}),
|
|
479
|
+
includes_superseded: transcript.includesSuperseded,
|
|
480
|
+
turns,
|
|
481
|
+
resolved_outputs: resolvedOutputs,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../src/execution/transcript.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,wEAAwE;AACxE,uEAAuE;AACvE,6BAA6B;AAC7B,EAAE;AACF,qCAAqC;AACrC,yEAAyE;AACzE,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,yEAAyE;AACzE,kBAAkB;AAClB,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,8DAA8D;AAC9D,6EAA6E;AAC7E,8EAA8E;AAC9E,gDAAgD;AAChD,2EAA2E;AAC3E,mEAAmE;AACnE,uEAAuE;AACvE,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,gBAAgB;AAChB,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAkB,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAK5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAMnG,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,8DAA8D,CAAC;AAOtE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,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,UAAU;YAC5B,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,SAAS;YAClD,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,SAAS;YACxC,WAAW,EAAE,IAAI,CAAC,UAAU,IAAI,SAAS;YACzC,SAAS;SACc,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GAA8B,EAAE,CAAC;IACtD,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACvE,eAAe,CAAC,GAAG,CAAC,GAAG;YACrB,WAAW,EAAE,MAAM,CAAC,UAAU;YAC9B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;YACxC,gBAAgB,EAAE,MAAM,CAAC,cAAc;YACvC,SAAS,EAAE,MAAM,CAAC,QAAQ;YAC1B,QAAQ,EAAE,MAAM,CAAC,OAAO,IAAI,SAAS;YACrC,KAAK,EAAE,MAAM,CAAC,KAAK;SACI,CAAC;IAC5B,CAAC;IAED,OAAO;QACL,MAAM,EAAE,kCAAkC;QAC1C,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,EAAE;YACjD,iBAAiB,EAAE,IAAI;SACxB,CAAC;QACF,mBAAmB,EAAE,UAAU,CAAC,kBAAkB;QAClD,KAAK;QACL,gBAAgB,EAAE,eAAe;KAClC,CAAC;AACJ,CAAC"}
|
package/gen/agent.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ export declare class AgentClient {
|
|
|
22
22
|
}
|
|
23
23
|
/** Input for creating/updating a Agent. */
|
|
24
24
|
export interface AgentInput {
|
|
25
|
+
/**
|
|
26
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
27
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
28
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
29
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
30
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
31
|
+
*/
|
|
32
|
+
id?: string;
|
|
25
33
|
name: string;
|
|
26
34
|
slug?: string;
|
|
27
35
|
org: string;
|
|
@@ -68,4 +76,17 @@ export interface EnvVarDeclarationInput {
|
|
|
68
76
|
optional?: boolean;
|
|
69
77
|
}
|
|
70
78
|
export declare function buildAgentProto(input: AgentInput): Agent;
|
|
79
|
+
/**
|
|
80
|
+
* Maps a fetched {@link Agent} to a complete {@link AgentInput} for `update()`.
|
|
81
|
+
*
|
|
82
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
83
|
+
* and override only the fields you edit (spread nested objects the same
|
|
84
|
+
* way):
|
|
85
|
+
*
|
|
86
|
+
* await client.update({ ...toAgentUpdateInput(res), description: next });
|
|
87
|
+
*
|
|
88
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
89
|
+
* `version` (pinned refs) and `kind`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function toAgentUpdateInput(resource: Agent): AgentInput;
|
|
71
92
|
//# sourceMappingURL=agent.d.ts.map
|
package/gen/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/gen/agent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAE7F,OAAO,EAA+C,KAAK,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAK7I,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAA8B,KAAK,qBAAqB,EAAE,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C;AAC5C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA4CD,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CA6BxD;AA4CD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,KAAK,GAAG,UAAU,CAqB9D"}
|
package/gen/agent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
import { wrapError } from "./errors.js";
|
|
3
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
3
|
+
import { stripUndefined, toResourceRefInput, toResourceRefInputs } from "./proto-utils.js";
|
|
4
4
|
import { create } from "@bufbuild/protobuf";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
@@ -168,6 +168,7 @@ export function buildAgentProto(input) {
|
|
|
168
168
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
169
169
|
kind: "Agent",
|
|
170
170
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
171
|
+
...(input.id && { id: input.id }),
|
|
171
172
|
name: input.name,
|
|
172
173
|
org: input.org,
|
|
173
174
|
...(input.slug && { slug: input.slug }),
|
|
@@ -185,4 +186,75 @@ export function buildAgentProto(input) {
|
|
|
185
186
|
})),
|
|
186
187
|
});
|
|
187
188
|
}
|
|
189
|
+
function toToolApprovalOverrideInput(msg) {
|
|
190
|
+
return {
|
|
191
|
+
toolName: msg.toolName || undefined,
|
|
192
|
+
requiresApproval: msg.requiresApproval || undefined,
|
|
193
|
+
message: msg.message || undefined,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function toMcpServerUsageInput(msg) {
|
|
197
|
+
return {
|
|
198
|
+
mcpServerRef: toResourceRefInput(msg.mcpServerRef) ?? { org: "", slug: "" },
|
|
199
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
200
|
+
toolApprovalOverrides: msg.toolApprovalOverrides?.length ? msg.toolApprovalOverrides.map(toToolApprovalOverrideInput) : undefined,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function toMcpAccessInput(msg) {
|
|
204
|
+
return {
|
|
205
|
+
mcpServer: msg.mcpServer ?? "",
|
|
206
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function toSubAgentInput(msg) {
|
|
210
|
+
return {
|
|
211
|
+
name: msg.name ?? "",
|
|
212
|
+
description: msg.description || undefined,
|
|
213
|
+
instructions: msg.instructions || undefined,
|
|
214
|
+
mcpAccess: msg.mcpAccess?.length ? msg.mcpAccess.map(toMcpAccessInput) : undefined,
|
|
215
|
+
skillRefs: toResourceRefInputs(msg.skillRefs),
|
|
216
|
+
modelOverride: msg.modelOverride || undefined,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function toEnvVarDeclarationInput(msg) {
|
|
220
|
+
return {
|
|
221
|
+
isSecret: msg.isSecret || undefined,
|
|
222
|
+
description: msg.description || undefined,
|
|
223
|
+
optional: msg.optional || undefined,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Maps a fetched {@link Agent} to a complete {@link AgentInput} for `update()`.
|
|
228
|
+
*
|
|
229
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
230
|
+
* and override only the fields you edit (spread nested objects the same
|
|
231
|
+
* way):
|
|
232
|
+
*
|
|
233
|
+
* await client.update({ ...toAgentUpdateInput(res), description: next });
|
|
234
|
+
*
|
|
235
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
236
|
+
* `version` (pinned refs) and `kind`.
|
|
237
|
+
*/
|
|
238
|
+
export function toAgentUpdateInput(resource) {
|
|
239
|
+
const meta = resource.metadata;
|
|
240
|
+
const spec = resource.spec ?? create(AgentSpecSchema);
|
|
241
|
+
return {
|
|
242
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
243
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
244
|
+
// match, so the id is the ONLY working address.
|
|
245
|
+
id: meta?.id || undefined,
|
|
246
|
+
name: meta?.name ?? "",
|
|
247
|
+
slug: meta?.slug || undefined,
|
|
248
|
+
org: meta?.org ?? "",
|
|
249
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
250
|
+
visibility: meta?.visibility || undefined,
|
|
251
|
+
description: spec.description || undefined,
|
|
252
|
+
iconUrl: spec.iconUrl || undefined,
|
|
253
|
+
instructions: spec.instructions || undefined,
|
|
254
|
+
mcpServerUsages: spec.mcpServerUsages?.length ? spec.mcpServerUsages.map(toMcpServerUsageInput) : undefined,
|
|
255
|
+
skillRefs: toResourceRefInputs(spec.skillRefs),
|
|
256
|
+
subAgents: spec.subAgents?.length ? spec.subAgents.map(toSubAgentInput) : undefined,
|
|
257
|
+
env: Object.keys(spec.env ?? {}).length > 0 ? Object.fromEntries(Object.entries(spec.env).map(([k, v]) => [k, toEnvVarDeclarationInput(v)])) : undefined,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
188
260
|
//# sourceMappingURL=agent.js.map
|