@stigmer/sdk 3.12.6 → 3.12.8
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.js +4 -0
- package/__tests__/update-input-roundtrip.test.js.map +1 -1
- package/execution/__tests__/tool-view.fixtures.test.js +6 -0
- package/execution/__tests__/tool-view.fixtures.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/tool-view.d.ts +10 -0
- package/execution/tool-view.d.ts.map +1 -1
- package/execution/tool-view.js +39 -0
- package/execution/tool-view.js.map +1 -1
- 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/agentexecution.d.ts +11 -0
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +30 -1
- package/gen/agentexecution.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/identityaccount.d.ts +2 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +4 -0
- package/gen/identityaccount.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/organization.d.ts +1 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +2 -0
- package/gen/organization.js.map +1 -1
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/update-input-roundtrip.test.ts +4 -0
- package/src/execution/__tests__/tool-view.fixtures.test.ts +8 -0
- 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/tool-view.ts +56 -0
- package/src/execution/transcript.ts +735 -0
- package/src/gen/agentexecution.ts +45 -1
- package/src/gen/client.ts +6 -1
- package/src/gen/identityaccount.ts +6 -0
- package/src/gen/memory.ts +164 -0
- package/src/gen/organization.ts +3 -0
- package/src/index.ts +28 -0
|
@@ -12,7 +12,7 @@ import { AgentExecutionCommandController } from "@stigmer/protos/ai/stigmer/agen
|
|
|
12
12
|
import { InteractionMode, ApprovalMode, ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
13
13
|
import { AgentExecutionIdSchema, AgentExecutionUpdateStatusInputSchema, UpdateStatusResponseSchema, SubmitApprovalInputSchema, SubmitFileDecisionInputSchema, CancelAgentExecutionInputSchema, TerminateAgentExecutionInputSchema, RecoverAgentExecutionInputSchema, PauseAgentExecutionInputSchema, ResumeAgentExecutionInputSchema, UploadAttachmentRequestSchema, UploadAttachmentResponseSchema, ListAgentExecutionsRequestSchema, AgentExecutionListSchema, ListAgentExecutionsBySessionRequestSchema, GetArtifactDownloadUrlRequestSchema, GetArtifactDownloadUrlResponseSchema, GetArtifactContentRequestSchema, GetArtifactContentResponseSchema, GetExecutionUsageReportInputSchema, GetExecutionUsageReportOutputSchema, GetSessionUsageReportInputSchema, GetSessionUsageReportOutputSchema, GetAgentUsageReportInputSchema, GetAgentUsageReportOutputSchema, GetOrgUsageReportInputSchema, GetOrgUsageReportOutputSchema, GetAgentExecutionSummaryRequestSchema, AgentExecutionSummarySchema, type AgentExecutionUpdateStatusInput, type UpdateStatusResponse, type SubmitApprovalInput, type SubmitFileDecisionInput, type CancelAgentExecutionInput, type TerminateAgentExecutionInput, type RecoverAgentExecutionInput, type PauseAgentExecutionInput, type ResumeAgentExecutionInput, type UploadAttachmentRequest, type UploadAttachmentResponse, type ListAgentExecutionsRequest, type AgentExecutionList, type ListAgentExecutionsBySessionRequest, type GetArtifactDownloadUrlRequest, type GetArtifactDownloadUrlResponse, type GetArtifactContentRequest, type GetArtifactContentResponse, type GetExecutionUsageReportInput, type GetExecutionUsageReportOutput, type GetSessionUsageReportInput, type GetSessionUsageReportOutput, type GetAgentUsageReportInput, type GetAgentUsageReportOutput, type GetOrgUsageReportInput, type GetOrgUsageReportOutput, type GetAgentExecutionSummaryRequest, type AgentExecutionSummary } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
|
|
14
14
|
import { AgentExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/query_pb";
|
|
15
|
-
import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema, ConversationCatchupSchema, DeclaredPreferencesSchema, type ContextManagementConfig, type ExecutionConfig, type Attachment, type ConversationCatchup, type DeclaredPreferences } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
15
|
+
import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema, ConversationCatchupSchema, DeclaredPreferencesSchema, RecalledMemoryFactSchema, RecalledMemoriesSchema, type ContextManagementConfig, type ExecutionConfig, type Attachment, type ConversationCatchup, type DeclaredPreferences, type RecalledMemoryFact, type RecalledMemories } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
16
16
|
import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
17
17
|
import { Harness, CursorMode, ExecutionTarget, GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
18
18
|
import { SessionSpecSchema, type SessionSpec } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
|
|
@@ -202,6 +202,7 @@ export interface AgentExecutionInput {
|
|
|
202
202
|
supersedesExecutionId?: string;
|
|
203
203
|
conversationCatchup?: ConversationCatchupInput;
|
|
204
204
|
declaredPreferences?: DeclaredPreferencesInput;
|
|
205
|
+
recalledMemories?: RecalledMemoriesInput;
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
/** SDK input type for SessionSpec. */
|
|
@@ -303,6 +304,18 @@ export interface DeclaredPreferencesInput {
|
|
|
303
304
|
userContext?: string;
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
/** SDK input type for RecalledMemories. */
|
|
308
|
+
export interface RecalledMemoriesInput {
|
|
309
|
+
enabled?: boolean;
|
|
310
|
+
facts?: RecalledMemoryFactInput[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** SDK input type for RecalledMemoryFact. */
|
|
314
|
+
export interface RecalledMemoryFactInput {
|
|
315
|
+
memoryId?: string;
|
|
316
|
+
content?: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
306
319
|
function buildGitRepoSourceProto(input: GitRepoSourceInput) {
|
|
307
320
|
return Object.assign(create(GitRepoSourceSchema), stripUndefined({
|
|
308
321
|
url: input.url,
|
|
@@ -417,6 +430,20 @@ function buildDeclaredPreferencesProto(input: DeclaredPreferencesInput) {
|
|
|
417
430
|
}));
|
|
418
431
|
}
|
|
419
432
|
|
|
433
|
+
function buildRecalledMemoryFactProto(input: RecalledMemoryFactInput) {
|
|
434
|
+
return Object.assign(create(RecalledMemoryFactSchema), stripUndefined({
|
|
435
|
+
memoryId: input.memoryId,
|
|
436
|
+
content: input.content,
|
|
437
|
+
}));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function buildRecalledMemoriesProto(input: RecalledMemoriesInput) {
|
|
441
|
+
const msg = create(RecalledMemoriesSchema);
|
|
442
|
+
if (input.enabled !== undefined) msg.enabled = input.enabled;
|
|
443
|
+
if (input.facts) msg.facts = input.facts.map(buildRecalledMemoryFactProto);
|
|
444
|
+
return msg;
|
|
445
|
+
}
|
|
446
|
+
|
|
420
447
|
export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecution {
|
|
421
448
|
const sessionSpec = input.sessionSpec ? buildSessionSpecProto(input.sessionSpec) : undefined;
|
|
422
449
|
const executionConfig = input.executionConfig ? buildExecutionConfigProto(input.executionConfig) : undefined;
|
|
@@ -428,6 +455,7 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
428
455
|
const attachments = input.attachments?.map(buildAttachmentProto);
|
|
429
456
|
const conversationCatchup = input.conversationCatchup ? buildConversationCatchupProto(input.conversationCatchup) : undefined;
|
|
430
457
|
const declaredPreferences = input.declaredPreferences ? buildDeclaredPreferencesProto(input.declaredPreferences) : undefined;
|
|
458
|
+
const recalledMemories = input.recalledMemories ? buildRecalledMemoriesProto(input.recalledMemories) : undefined;
|
|
431
459
|
return Object.assign(create(AgentExecutionSchema), {
|
|
432
460
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
433
461
|
kind: "AgentExecution",
|
|
@@ -455,6 +483,7 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
455
483
|
supersedesExecutionId: input.supersedesExecutionId,
|
|
456
484
|
conversationCatchup,
|
|
457
485
|
declaredPreferences,
|
|
486
|
+
recalledMemories,
|
|
458
487
|
})),
|
|
459
488
|
}) as AgentExecution;
|
|
460
489
|
}
|
|
@@ -570,6 +599,20 @@ function toDeclaredPreferencesInput(msg: DeclaredPreferences): DeclaredPreferenc
|
|
|
570
599
|
};
|
|
571
600
|
}
|
|
572
601
|
|
|
602
|
+
function toRecalledMemoryFactInput(msg: RecalledMemoryFact): RecalledMemoryFactInput {
|
|
603
|
+
return {
|
|
604
|
+
memoryId: msg.memoryId || undefined,
|
|
605
|
+
content: msg.content || undefined,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function toRecalledMemoriesInput(msg: RecalledMemories): RecalledMemoriesInput {
|
|
610
|
+
return {
|
|
611
|
+
enabled: msg.enabled || undefined,
|
|
612
|
+
facts: msg.facts?.length ? msg.facts.map(toRecalledMemoryFactInput) : undefined,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
573
616
|
/**
|
|
574
617
|
* Maps a fetched {@link AgentExecution} to a complete {@link AgentExecutionInput} for `update()`.
|
|
575
618
|
*
|
|
@@ -610,5 +653,6 @@ export function toAgentExecutionUpdateInput(resource: AgentExecution): AgentExec
|
|
|
610
653
|
supersedesExecutionId: spec.supersedesExecutionId || undefined,
|
|
611
654
|
conversationCatchup: spec.conversationCatchup ? toConversationCatchupInput(spec.conversationCatchup) : undefined,
|
|
612
655
|
declaredPreferences: spec.declaredPreferences ? toDeclaredPreferencesInput(spec.declaredPreferences) : undefined,
|
|
656
|
+
recalledMemories: spec.recalledMemories ? toRecalledMemoriesInput(spec.recalledMemories) : undefined,
|
|
613
657
|
};
|
|
614
658
|
}
|
package/src/gen/client.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { IdentityAccountClient } from "./identityaccount.js";
|
|
|
16
16
|
import { IdentityProviderClient } from "./identityprovider.js";
|
|
17
17
|
import { InvitationClient } from "./invitation.js";
|
|
18
18
|
import { McpServerClient } from "./mcpserver.js";
|
|
19
|
+
import { MemoryClient } from "./memory.js";
|
|
19
20
|
import { OAuthAppClient } from "./oauthapp.js";
|
|
20
21
|
import { OrganizationClient } from "./organization.js";
|
|
21
22
|
import { PlatformClientClient } from "./platformclient.js";
|
|
@@ -44,6 +45,7 @@ export class GeneratedClient {
|
|
|
44
45
|
readonly identityProvider: IdentityProviderClient;
|
|
45
46
|
readonly invitation: InvitationClient;
|
|
46
47
|
readonly mcpServer: McpServerClient;
|
|
48
|
+
readonly memory: MemoryClient;
|
|
47
49
|
readonly oauthapp: OAuthAppClient;
|
|
48
50
|
readonly organization: OrganizationClient;
|
|
49
51
|
readonly platformclient: PlatformClientClient;
|
|
@@ -71,6 +73,7 @@ export class GeneratedClient {
|
|
|
71
73
|
this.identityProvider = new IdentityProviderClient(transport);
|
|
72
74
|
this.invitation = new InvitationClient(transport);
|
|
73
75
|
this.mcpServer = new McpServerClient(transport);
|
|
76
|
+
this.memory = new MemoryClient(transport);
|
|
74
77
|
this.oauthapp = new OAuthAppClient(transport);
|
|
75
78
|
this.organization = new OrganizationClient(transport);
|
|
76
79
|
this.platformclient = new PlatformClientClient(transport);
|
|
@@ -90,7 +93,7 @@ export { type AgentInput, type McpServerUsageInput, type ToolApprovalOverrideInp
|
|
|
90
93
|
export { AgentChannelClient } from "./agentchannel.js";
|
|
91
94
|
export { type AgentChannelInput, type SlackChannelConfigInput, type WhatsAppChannelConfigInput, type RunConfigInput } from "./agentchannel.js";
|
|
92
95
|
export { AgentExecutionClient } from "./agentexecution.js";
|
|
93
|
-
export { type AgentExecutionInput, type SessionSpecInput, type WorkspaceEntryInput, type WorkspaceSourceInput, type GitRepoSourceInput, type LocalPathSourceInput, type ExecutionConfigInput, type ContextManagementConfigInput, type AttachmentInput, type ConversationCatchupInput, type DeclaredPreferencesInput } from "./agentexecution.js";
|
|
96
|
+
export { type AgentExecutionInput, type SessionSpecInput, type WorkspaceEntryInput, type WorkspaceSourceInput, type GitRepoSourceInput, type LocalPathSourceInput, type ExecutionConfigInput, type ContextManagementConfigInput, type AttachmentInput, type ConversationCatchupInput, type DeclaredPreferencesInput, type RecalledMemoriesInput, type RecalledMemoryFactInput } from "./agentexecution.js";
|
|
94
97
|
export { AgentInstanceClient } from "./agentinstance.js";
|
|
95
98
|
export { type AgentInstanceInput } from "./agentinstance.js";
|
|
96
99
|
export { AgentShareClient } from "./agentshare.js";
|
|
@@ -115,6 +118,8 @@ export { InvitationClient } from "./invitation.js";
|
|
|
115
118
|
export { type InvitationInput } from "./invitation.js";
|
|
116
119
|
export { McpServerClient } from "./mcpserver.js";
|
|
117
120
|
export { type McpServerInput, type StdioServerConfigInput, type HttpServerConfigInput, type ToolApprovalPolicyInput, type McpServerAuthInput } from "./mcpserver.js";
|
|
121
|
+
export { MemoryClient } from "./memory.js";
|
|
122
|
+
export { type MemoryInput, type MemoryProvenanceInput } from "./memory.js";
|
|
118
123
|
export { OAuthAppClient } from "./oauthapp.js";
|
|
119
124
|
export { type OAuthAppInput } from "./oauthapp.js";
|
|
120
125
|
export { OrganizationClient } from "./organization.js";
|
|
@@ -138,6 +138,8 @@ export interface IdentityAccountPreferencesInput {
|
|
|
138
138
|
defaultHarness?: string;
|
|
139
139
|
defaultNativeModel?: string;
|
|
140
140
|
defaultCursorModel?: string;
|
|
141
|
+
memoryEnabled?: boolean;
|
|
142
|
+
defaultAutoApprove?: boolean;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
function buildIdentityAccountPreferencesProto(input: IdentityAccountPreferencesInput) {
|
|
@@ -146,6 +148,8 @@ function buildIdentityAccountPreferencesProto(input: IdentityAccountPreferencesI
|
|
|
146
148
|
defaultHarness: input.defaultHarness,
|
|
147
149
|
defaultNativeModel: input.defaultNativeModel,
|
|
148
150
|
defaultCursorModel: input.defaultCursorModel,
|
|
151
|
+
memoryEnabled: input.memoryEnabled,
|
|
152
|
+
defaultAutoApprove: input.defaultAutoApprove,
|
|
149
153
|
}));
|
|
150
154
|
}
|
|
151
155
|
|
|
@@ -183,6 +187,8 @@ function toIdentityAccountPreferencesInput(msg: IdentityAccountPreferences): Ide
|
|
|
183
187
|
defaultHarness: msg.defaultHarness || undefined,
|
|
184
188
|
defaultNativeModel: msg.defaultNativeModel || undefined,
|
|
185
189
|
defaultCursorModel: msg.defaultCursorModel || undefined,
|
|
190
|
+
memoryEnabled: msg.memoryEnabled || undefined,
|
|
191
|
+
defaultAutoApprove: msg.defaultAutoApprove || undefined,
|
|
186
192
|
};
|
|
187
193
|
}
|
|
188
194
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import { wrapError } from "./errors.js";
|
|
4
|
+
import { stripUndefined } from "./proto-utils.js";
|
|
5
|
+
import { create } from "@bufbuild/protobuf";
|
|
6
|
+
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
7
|
+
import { MemorySchema, type Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
8
|
+
import { MemoryCommandController } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/command_pb";
|
|
9
|
+
import { MemoryIdSchema, ListMemoriesRequestSchema, MemoryListSchema, type ListMemoriesRequest, type MemoryList } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/io_pb";
|
|
10
|
+
import { MemoryQueryController } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/query_pb";
|
|
11
|
+
import { MemorySpecSchema, MemoryProvenanceSchema, type MemoryProvenance } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/spec_pb";
|
|
12
|
+
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
13
|
+
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
14
|
+
|
|
15
|
+
/** Provides operations on memory resources. */
|
|
16
|
+
export class MemoryClient {
|
|
17
|
+
private readonly command: Client<typeof MemoryCommandController>;
|
|
18
|
+
private readonly query: Client<typeof MemoryQueryController>;
|
|
19
|
+
|
|
20
|
+
constructor(transport: Transport) {
|
|
21
|
+
this.command = createClient(MemoryCommandController, transport);
|
|
22
|
+
this.query = createClient(MemoryQueryController, transport);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async create(input: MemoryInput): Promise<Memory> {
|
|
26
|
+
try {
|
|
27
|
+
return await this.command.create(buildMemoryProto(input));
|
|
28
|
+
} catch (e) { throw wrapError(e); }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async update(input: MemoryInput): Promise<Memory> {
|
|
32
|
+
try {
|
|
33
|
+
return await this.command.update(buildMemoryProto(input));
|
|
34
|
+
} catch (e) { throw wrapError(e); }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async delete(id: string): Promise<Memory> {
|
|
38
|
+
try {
|
|
39
|
+
return await this.command.delete(create(MemoryIdSchema, { value: id }));
|
|
40
|
+
} catch (e) { throw wrapError(e); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async confirm(id: string): Promise<Memory> {
|
|
44
|
+
try {
|
|
45
|
+
return await this.command.confirm(create(MemoryIdSchema, { value: id }));
|
|
46
|
+
} catch (e) { throw wrapError(e); }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async reject(id: string): Promise<Memory> {
|
|
50
|
+
try {
|
|
51
|
+
return await this.command.reject(create(MemoryIdSchema, { value: id }));
|
|
52
|
+
} catch (e) { throw wrapError(e); }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async get(id: string): Promise<Memory> {
|
|
56
|
+
try {
|
|
57
|
+
return await this.query.get(create(MemoryIdSchema, { value: id }));
|
|
58
|
+
} catch (e) { throw wrapError(e); }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async list(input: ListMemoriesRequest): Promise<MemoryList> {
|
|
62
|
+
try {
|
|
63
|
+
return await this.query.list(input);
|
|
64
|
+
} catch (e) { throw wrapError(e); }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Input for creating/updating a Memory. */
|
|
69
|
+
export interface MemoryInput {
|
|
70
|
+
/**
|
|
71
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
72
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
73
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
74
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
75
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
76
|
+
*/
|
|
77
|
+
id?: string;
|
|
78
|
+
name: string;
|
|
79
|
+
slug?: string;
|
|
80
|
+
org: string;
|
|
81
|
+
labels?: Record<string, string>;
|
|
82
|
+
visibility?: ApiResourceVisibility;
|
|
83
|
+
content?: string;
|
|
84
|
+
subjectIdentityAccountId?: string;
|
|
85
|
+
provenance?: MemoryProvenanceInput;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** SDK input type for MemoryProvenance. */
|
|
89
|
+
export interface MemoryProvenanceInput {
|
|
90
|
+
agentId?: string;
|
|
91
|
+
sessionId?: string;
|
|
92
|
+
agentExecutionId?: string;
|
|
93
|
+
toolCallId?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function buildMemoryProvenanceProto(input: MemoryProvenanceInput) {
|
|
97
|
+
return Object.assign(create(MemoryProvenanceSchema), stripUndefined({
|
|
98
|
+
agentId: input.agentId,
|
|
99
|
+
sessionId: input.sessionId,
|
|
100
|
+
agentExecutionId: input.agentExecutionId,
|
|
101
|
+
toolCallId: input.toolCallId,
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function buildMemoryProto(input: MemoryInput): Memory {
|
|
106
|
+
const provenance = input.provenance ? buildMemoryProvenanceProto(input.provenance) : undefined;
|
|
107
|
+
return Object.assign(create(MemorySchema), {
|
|
108
|
+
apiVersion: "agentic.stigmer.ai/v1",
|
|
109
|
+
kind: "Memory",
|
|
110
|
+
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
111
|
+
...(input.id && { id: input.id }),
|
|
112
|
+
name: input.name,
|
|
113
|
+
org: input.org,
|
|
114
|
+
...(input.slug && { slug: input.slug }),
|
|
115
|
+
...(input.labels && { labels: input.labels }),
|
|
116
|
+
...(input.visibility && { visibility: input.visibility }),
|
|
117
|
+
}),
|
|
118
|
+
spec: Object.assign(create(MemorySpecSchema), stripUndefined({
|
|
119
|
+
content: input.content,
|
|
120
|
+
subjectIdentityAccountId: input.subjectIdentityAccountId,
|
|
121
|
+
provenance,
|
|
122
|
+
})),
|
|
123
|
+
}) as Memory;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function toMemoryProvenanceInput(msg: MemoryProvenance): MemoryProvenanceInput {
|
|
127
|
+
return {
|
|
128
|
+
agentId: msg.agentId || undefined,
|
|
129
|
+
sessionId: msg.sessionId || undefined,
|
|
130
|
+
agentExecutionId: msg.agentExecutionId || undefined,
|
|
131
|
+
toolCallId: msg.toolCallId || undefined,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Maps a fetched {@link Memory} to a complete {@link MemoryInput} for `update()`.
|
|
137
|
+
*
|
|
138
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
139
|
+
* and override only the fields you edit (spread nested objects the same
|
|
140
|
+
* way):
|
|
141
|
+
*
|
|
142
|
+
* await client.update({ ...toMemoryUpdateInput(res), description: next });
|
|
143
|
+
*
|
|
144
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
145
|
+
* `version` (pinned refs) and `kind`.
|
|
146
|
+
*/
|
|
147
|
+
export function toMemoryUpdateInput(resource: Memory): MemoryInput {
|
|
148
|
+
const meta = resource.metadata;
|
|
149
|
+
const spec = resource.spec ?? create(MemorySpecSchema);
|
|
150
|
+
return {
|
|
151
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
152
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
153
|
+
// match, so the id is the ONLY working address.
|
|
154
|
+
id: meta?.id || undefined,
|
|
155
|
+
name: meta?.name ?? "",
|
|
156
|
+
slug: meta?.slug || undefined,
|
|
157
|
+
org: meta?.org ?? "",
|
|
158
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
159
|
+
visibility: meta?.visibility || undefined,
|
|
160
|
+
content: spec.content || undefined,
|
|
161
|
+
subjectIdentityAccountId: spec.subjectIdentityAccountId || undefined,
|
|
162
|
+
provenance: spec.provenance ? toMemoryProvenanceInput(spec.provenance) : undefined,
|
|
163
|
+
};
|
|
164
|
+
}
|
package/src/gen/organization.ts
CHANGED
|
@@ -102,11 +102,13 @@ export interface OrganizationInput {
|
|
|
102
102
|
/** SDK input type for OrganizationPreferences. */
|
|
103
103
|
export interface OrganizationPreferencesInput {
|
|
104
104
|
standingContext?: string;
|
|
105
|
+
memoryEnabled?: boolean;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
function buildOrganizationPreferencesProto(input: OrganizationPreferencesInput) {
|
|
108
109
|
return Object.assign(create(OrganizationPreferencesSchema), stripUndefined({
|
|
109
110
|
standingContext: input.standingContext,
|
|
111
|
+
memoryEnabled: input.memoryEnabled,
|
|
110
112
|
}));
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -139,6 +141,7 @@ export function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
|
139
141
|
function toOrganizationPreferencesInput(msg: OrganizationPreferences): OrganizationPreferencesInput {
|
|
140
142
|
return {
|
|
141
143
|
standingContext: msg.standingContext || undefined,
|
|
144
|
+
memoryEnabled: msg.memoryEnabled || undefined,
|
|
142
145
|
};
|
|
143
146
|
}
|
|
144
147
|
|
package/src/index.ts
CHANGED
|
@@ -249,6 +249,13 @@ export {
|
|
|
249
249
|
type HttpServerConfigInput,
|
|
250
250
|
type ToolApprovalPolicyInput,
|
|
251
251
|
} from "./gen/mcpserver.js";
|
|
252
|
+
export {
|
|
253
|
+
MemoryClient,
|
|
254
|
+
buildMemoryProto,
|
|
255
|
+
toMemoryUpdateInput,
|
|
256
|
+
type MemoryInput,
|
|
257
|
+
type MemoryProvenanceInput,
|
|
258
|
+
} from "./gen/memory.js";
|
|
252
259
|
export {
|
|
253
260
|
connectAndWait,
|
|
254
261
|
ConnectStillRunningError,
|
|
@@ -314,6 +321,27 @@ export {
|
|
|
314
321
|
isInformativePolicySource,
|
|
315
322
|
} from "./execution/approval-provenance.js";
|
|
316
323
|
export { isTerminalPhase } from "./execution/execution-phases.js";
|
|
324
|
+
export {
|
|
325
|
+
sortChronologically,
|
|
326
|
+
supersededExecutionIds,
|
|
327
|
+
isBuildFromPlanTurn,
|
|
328
|
+
syntheticUserPrompt,
|
|
329
|
+
execIdFromStorageKey,
|
|
330
|
+
} from "./execution/conversation-rules.js";
|
|
331
|
+
export {
|
|
332
|
+
assembleSessionTranscript,
|
|
333
|
+
fetchSessionTranscript,
|
|
334
|
+
resolveOffloadedOutputs,
|
|
335
|
+
transcriptToMarkdown,
|
|
336
|
+
transcriptToJson,
|
|
337
|
+
type SessionTranscript,
|
|
338
|
+
type TranscriptTurn,
|
|
339
|
+
type ResolvedToolOutput,
|
|
340
|
+
type SessionTranscriptClient,
|
|
341
|
+
type AssembleSessionTranscriptOptions,
|
|
342
|
+
type FetchSessionTranscriptOptions,
|
|
343
|
+
type TranscriptToMarkdownOptions,
|
|
344
|
+
} from "./execution/transcript.js";
|
|
317
345
|
export {
|
|
318
346
|
foldFileReviewEventStream,
|
|
319
347
|
displayFileChangeSets,
|