@stigmer/sdk 3.2.2 → 3.3.0

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.
Files changed (102) hide show
  1. package/__tests__/errors.test.js +44 -1
  2. package/__tests__/errors.test.js.map +1 -1
  3. package/__tests__/manifest.test.d.ts +2 -0
  4. package/__tests__/manifest.test.d.ts.map +1 -0
  5. package/__tests__/manifest.test.js +229 -0
  6. package/__tests__/manifest.test.js.map +1 -0
  7. package/billing.d.ts +83 -1
  8. package/billing.d.ts.map +1 -1
  9. package/billing.js +91 -1
  10. package/billing.js.map +1 -1
  11. package/cursor-accounts.d.ts +94 -0
  12. package/cursor-accounts.d.ts.map +1 -0
  13. package/cursor-accounts.js +119 -0
  14. package/cursor-accounts.js.map +1 -0
  15. package/errors.d.ts +14 -0
  16. package/errors.d.ts.map +1 -1
  17. package/errors.js +26 -0
  18. package/errors.js.map +1 -1
  19. package/execution/approval-provenance.d.ts.map +1 -1
  20. package/execution/approval-provenance.js +7 -0
  21. package/execution/approval-provenance.js.map +1 -1
  22. package/gen/agent.d.ts +5 -0
  23. package/gen/agent.d.ts.map +1 -1
  24. package/gen/agent.js +9 -1
  25. package/gen/agent.js.map +1 -1
  26. package/gen/agentexecution.d.ts +3 -1
  27. package/gen/agentexecution.d.ts.map +1 -1
  28. package/gen/agentexecution.js +4 -0
  29. package/gen/agentexecution.js.map +1 -1
  30. package/gen/agentinstance.d.ts +1 -0
  31. package/gen/agentinstance.d.ts.map +1 -1
  32. package/gen/agentinstance.js +1 -0
  33. package/gen/agentinstance.js.map +1 -1
  34. package/gen/authorization-config.d.ts.map +1 -1
  35. package/gen/authorization-config.js +1 -0
  36. package/gen/authorization-config.js.map +1 -1
  37. package/gen/client.d.ts +6 -2
  38. package/gen/client.d.ts.map +1 -1
  39. package/gen/client.js +4 -0
  40. package/gen/client.js.map +1 -1
  41. package/gen/datastore.d.ts +128 -0
  42. package/gen/datastore.d.ts.map +1 -0
  43. package/gen/datastore.js +302 -0
  44. package/gen/datastore.js.map +1 -0
  45. package/gen/session.d.ts +1 -0
  46. package/gen/session.d.ts.map +1 -1
  47. package/gen/session.js +1 -0
  48. package/gen/session.js.map +1 -1
  49. package/index.d.ts +5 -3
  50. package/index.d.ts.map +1 -1
  51. package/index.js +7 -3
  52. package/index.js.map +1 -1
  53. package/manifest/client.d.ts +64 -0
  54. package/manifest/client.d.ts.map +1 -0
  55. package/manifest/client.js +109 -0
  56. package/manifest/client.js.map +1 -0
  57. package/manifest/index.d.ts +9 -0
  58. package/manifest/index.d.ts.map +1 -0
  59. package/manifest/index.js +11 -0
  60. package/manifest/index.js.map +1 -0
  61. package/manifest/parse.d.ts +57 -0
  62. package/manifest/parse.d.ts.map +1 -0
  63. package/manifest/parse.js +134 -0
  64. package/manifest/parse.js.map +1 -0
  65. package/manifest/redaction.d.ts +16 -0
  66. package/manifest/redaction.d.ts.map +1 -0
  67. package/manifest/redaction.js +19 -0
  68. package/manifest/redaction.js.map +1 -0
  69. package/manifest/registry.d.ts +44 -0
  70. package/manifest/registry.d.ts.map +1 -0
  71. package/manifest/registry.js +178 -0
  72. package/manifest/registry.js.map +1 -0
  73. package/manifest/serialize.d.ts +24 -0
  74. package/manifest/serialize.d.ts.map +1 -0
  75. package/manifest/serialize.js +78 -0
  76. package/manifest/serialize.js.map +1 -0
  77. package/package.json +4 -3
  78. package/src/__tests__/errors.test.ts +58 -0
  79. package/src/__tests__/manifest.test.ts +271 -0
  80. package/src/billing.ts +160 -0
  81. package/src/cursor-accounts.ts +207 -0
  82. package/src/errors.ts +27 -0
  83. package/src/execution/approval-provenance.ts +7 -0
  84. package/src/gen/agent.ts +15 -1
  85. package/src/gen/agentexecution.ts +5 -1
  86. package/src/gen/agentinstance.ts +2 -0
  87. package/src/gen/authorization-config.ts +1 -0
  88. package/src/gen/client.ts +7 -2
  89. package/src/gen/datastore.ts +379 -0
  90. package/src/gen/session.ts +2 -0
  91. package/src/index.ts +30 -0
  92. package/src/manifest/client.ts +145 -0
  93. package/src/manifest/index.ts +25 -0
  94. package/src/manifest/parse.ts +204 -0
  95. package/src/manifest/redaction.ts +20 -0
  96. package/src/manifest/registry.ts +232 -0
  97. package/src/manifest/serialize.ts +92 -0
  98. package/src/stigmer.ts +8 -0
  99. package/stigmer.d.ts +6 -0
  100. package/stigmer.d.ts.map +1 -1
  101. package/stigmer.js +8 -0
  102. package/stigmer.js.map +1 -1
@@ -37,6 +37,8 @@ export function describeApprovalPolicySource(
37
37
  return "auto-approved by a run-wide bypass";
38
38
  case ApprovalPolicySource.APPROVAL_LEASE:
39
39
  return "auto-approved by a run lease";
40
+ case ApprovalPolicySource.UNATTENDED_SKIP:
41
+ return "skipped: approval not available on this surface";
40
42
  case ApprovalPolicySource.UNSPECIFIED:
41
43
  default:
42
44
  return null;
@@ -70,6 +72,11 @@ export function isInformativePolicySource(
70
72
  case ApprovalPolicySource.ANNOTATION_DESTRUCTIVE_TIGHTEN:
71
73
  case ApprovalPolicySource.AUTO_APPROVE_ALL:
72
74
  case ApprovalPolicySource.APPROVAL_LEASE:
75
+ // An unattended skip is a platform RESOLUTION, not an everyday gating
76
+ // default: an org admin reviewing a channel conversation (DD-012
77
+ // observer) needs to see why the tool did not run — and that no human
78
+ // declined it.
79
+ case ApprovalPolicySource.UNATTENDED_SKIP:
73
80
  return true;
74
81
  case ApprovalPolicySource.CLASSIFIER_DEFAULT:
75
82
  case ApprovalPolicySource.BUILTIN_CATEGORY:
package/src/gen/agent.ts CHANGED
@@ -9,7 +9,7 @@ import { AgentSchema, type Agent } from "@stigmer/protos/ai/stigmer/agentic/agen
9
9
  import { AgentCommandController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/command_pb";
10
10
  import { AgentIdSchema, GetDefaultAgentRequestSchema, type GetDefaultAgentRequest } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
11
11
  import { AgentQueryController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/query_pb";
12
- import { AgentSpecSchema, ToolApprovalOverrideSchema, McpServerUsageSchema, McpAccessSchema, SubAgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
12
+ import { AgentSpecSchema, ToolApprovalOverrideSchema, McpServerUsageSchema, McpAccessSchema, SubAgentSchema, DatastoreUsageSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
13
13
  import { EnvVarDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
14
14
  import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
15
15
  import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
@@ -112,6 +112,7 @@ export interface AgentInput {
112
112
  skillRefs?: ResourceRef[];
113
113
  subAgents?: SubAgentInput[];
114
114
  env?: Record<string, EnvVarDeclarationInput>;
115
+ datastoreUsages?: DatastoreUsageInput[];
115
116
  }
116
117
 
117
118
  /** SDK input type for McpServerUsage. */
@@ -151,6 +152,11 @@ export interface EnvVarDeclarationInput {
151
152
  optional?: boolean;
152
153
  }
153
154
 
155
+ /** SDK input type for DatastoreUsage. */
156
+ export interface DatastoreUsageInput {
157
+ datastoreRef: ResourceRef;
158
+ }
159
+
154
160
  function buildToolApprovalOverrideProto(input: ToolApprovalOverrideInput) {
155
161
  return Object.assign(create(ToolApprovalOverrideSchema), stripUndefined({
156
162
  toolName: input.toolName,
@@ -193,6 +199,12 @@ function buildEnvVarDeclarationProto(input: EnvVarDeclarationInput) {
193
199
  }));
194
200
  }
195
201
 
202
+ function buildDatastoreUsageProto(input: DatastoreUsageInput) {
203
+ const msg = create(DatastoreUsageSchema);
204
+ if (input.datastoreRef?.slug || input.datastoreRef?.org) msg.datastoreRef = create(ApiResourceReferenceSchema, { ...input.datastoreRef, kind: 49 });
205
+ return msg;
206
+ }
207
+
196
208
  export function buildAgentProto(input: AgentInput): Agent {
197
209
  const mcpServerUsages = input.mcpServerUsages?.map(buildMcpServerUsageProto);
198
210
  const skillRefs = input.skillRefs?.map(r => create(ApiResourceReferenceSchema, { ...r, kind: 43 }));
@@ -201,6 +213,7 @@ export function buildAgentProto(input: AgentInput): Agent {
201
213
  if (input.env) {
202
214
  env = Object.fromEntries(Object.entries(input.env).map(([k, v]) => [k, buildEnvVarDeclarationProto(v)]));
203
215
  }
216
+ const datastoreUsages = input.datastoreUsages?.map(buildDatastoreUsageProto);
204
217
  return Object.assign(create(AgentSchema), {
205
218
  apiVersion: "agentic.stigmer.ai/v1",
206
219
  kind: "Agent",
@@ -219,6 +232,7 @@ export function buildAgentProto(input: AgentInput): Agent {
219
232
  skillRefs,
220
233
  subAgents,
221
234
  env,
235
+ datastoreUsages,
222
236
  })),
223
237
  }) as Agent;
224
238
  }
@@ -8,7 +8,7 @@ import { createClient, type Client, type Transport } from "@connectrpc/connect";
8
8
  import { ToolApprovalOverrideSchema, McpServerUsageSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
9
9
  import { AgentExecutionSchema, type AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
10
10
  import { AgentExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/command_pb";
11
- import { InteractionMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
11
+ import { InteractionMode, ApprovalMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
12
12
  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";
13
13
  import { AgentExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/query_pb";
14
14
  import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
@@ -198,6 +198,7 @@ export interface SessionSpecInput {
198
198
  agentInstanceId?: string;
199
199
  subject?: string;
200
200
  harnessStateId?: string;
201
+ harnessStateIdHistory?: string[];
201
202
  metadata?: Record<string, string>;
202
203
  workspaceEntries?: WorkspaceEntryInput[];
203
204
  mcpServerUsages?: McpServerUsageInput[];
@@ -257,6 +258,7 @@ export interface ExecutionConfigInput {
257
258
  interactionMode?: InteractionMode;
258
259
  structuredOutputSchema?: JsonObject;
259
260
  buildFromPlan?: boolean;
261
+ approvalMode?: ApprovalMode;
260
262
  }
261
263
 
262
264
  /** SDK input type for ContextManagementConfig. */
@@ -330,6 +332,7 @@ function buildSessionSpecProto(input: SessionSpecInput) {
330
332
  if (input.agentInstanceId !== undefined) msg.agentInstanceId = input.agentInstanceId;
331
333
  if (input.subject !== undefined) msg.subject = input.subject;
332
334
  if (input.harnessStateId !== undefined) msg.harnessStateId = input.harnessStateId;
335
+ if (input.harnessStateIdHistory) msg.harnessStateIdHistory = input.harnessStateIdHistory;
333
336
  if (input.metadata) Object.assign(msg.metadata, input.metadata);
334
337
  if (input.workspaceEntries) msg.workspaceEntries = input.workspaceEntries.map(buildWorkspaceEntryProto);
335
338
  if (input.mcpServerUsages) msg.mcpServerUsages = input.mcpServerUsages.map(buildMcpServerUsageProto);
@@ -358,6 +361,7 @@ function buildExecutionConfigProto(input: ExecutionConfigInput) {
358
361
  if (input.interactionMode !== undefined) msg.interactionMode = input.interactionMode;
359
362
  if (input.structuredOutputSchema !== undefined) msg.structuredOutputSchema = input.structuredOutputSchema;
360
363
  if (input.buildFromPlan !== undefined) msg.buildFromPlan = input.buildFromPlan;
364
+ if (input.approvalMode !== undefined) msg.approvalMode = input.approvalMode;
361
365
  return msg;
362
366
  }
363
367
 
@@ -90,6 +90,7 @@ export interface AgentInstanceInput {
90
90
  agentId?: string;
91
91
  description?: string;
92
92
  environmentRefs?: ResourceRef[];
93
+ datastorePartition?: string;
93
94
  }
94
95
 
95
96
  export function buildAgentInstanceProto(input: AgentInstanceInput): AgentInstance {
@@ -108,6 +109,7 @@ export function buildAgentInstanceProto(input: AgentInstanceInput): AgentInstanc
108
109
  agentId: input.agentId,
109
110
  description: input.description,
110
111
  environmentRefs,
112
+ datastorePartition: input.datastorePartition,
111
113
  })),
112
114
  }) as AgentInstance;
113
115
  }
@@ -26,6 +26,7 @@ export const GRANTABLE_ROLES: ReadonlyMap<ApiResourceKind, readonly IamRole[]> =
26
26
  [ApiResourceKind.agent_share, [IamRole.owner, IamRole.viewer]],
27
27
  [ApiResourceKind.agent_channel, [IamRole.owner, IamRole.viewer]],
28
28
  [ApiResourceKind.channel_app, [IamRole.owner, IamRole.viewer]],
29
+ [ApiResourceKind.datastore, [IamRole.owner, IamRole.viewer]],
29
30
  [ApiResourceKind.workflow, [IamRole.owner, IamRole.viewer]],
30
31
  [ApiResourceKind.workflow_instance, [IamRole.owner, IamRole.viewer]],
31
32
  [ApiResourceKind.workflow_execution, [IamRole.owner, IamRole.viewer]],
package/src/gen/client.ts CHANGED
@@ -9,6 +9,7 @@ import { AgentShareClient } from "./agentshare.js";
9
9
  import { ApiKeyClient } from "./apikey.js";
10
10
  import { ArtifactClient } from "./artifact.js";
11
11
  import { ChannelAppClient } from "./channelapp.js";
12
+ import { DatastoreClient } from "./datastore.js";
12
13
  import { EnvironmentClient } from "./environment.js";
13
14
  import { ExecutionContextClient } from "./executioncontext.js";
14
15
  import { IamPolicyClient } from "./iampolicy.js";
@@ -36,6 +37,7 @@ export class GeneratedClient {
36
37
  readonly apiKey: ApiKeyClient;
37
38
  readonly artifact: ArtifactClient;
38
39
  readonly channelapp: ChannelAppClient;
40
+ readonly datastore: DatastoreClient;
39
41
  readonly environment: EnvironmentClient;
40
42
  readonly executionContext: ExecutionContextClient;
41
43
  readonly iamPolicy: IamPolicyClient;
@@ -62,6 +64,7 @@ export class GeneratedClient {
62
64
  this.apiKey = new ApiKeyClient(transport);
63
65
  this.artifact = new ArtifactClient(transport);
64
66
  this.channelapp = new ChannelAppClient(transport);
67
+ this.datastore = new DatastoreClient(transport);
65
68
  this.environment = new EnvironmentClient(transport);
66
69
  this.executionContext = new ExecutionContextClient(transport);
67
70
  this.iamPolicy = new IamPolicyClient(transport);
@@ -83,7 +86,7 @@ export class GeneratedClient {
83
86
 
84
87
  // Re-export all resource client types and input types.
85
88
  export { AgentClient } from "./agent.js";
86
- export { type AgentInput, type McpServerUsageInput, type ToolApprovalOverrideInput, type SubAgentInput, type McpAccessInput, type EnvVarDeclarationInput } from "./agent.js";
89
+ export { type AgentInput, type McpServerUsageInput, type ToolApprovalOverrideInput, type SubAgentInput, type McpAccessInput, type EnvVarDeclarationInput, type DatastoreUsageInput } from "./agent.js";
87
90
  export { AgentChannelClient } from "./agentchannel.js";
88
91
  export { type AgentChannelInput, type SlackChannelConfigInput, type WhatsAppChannelConfigInput } from "./agentchannel.js";
89
92
  export { AgentExecutionClient } from "./agentexecution.js";
@@ -98,12 +101,14 @@ export { ArtifactClient } from "./artifact.js";
98
101
  export { type ArtifactInput, type ArtifactSourceInput, type RetentionPolicyInput } from "./artifact.js";
99
102
  export { ChannelAppClient } from "./channelapp.js";
100
103
  export { type ChannelAppInput, type SlackChannelAppConfigInput, type WhatsAppChannelAppConfigInput } from "./channelapp.js";
104
+ export { DatastoreClient } from "./datastore.js";
105
+ export { type DatastoreInput, type DatastoreAuthorizationInput, type DatastoreRoleInput, type DatastoreRoleBindingInput, type DatastoreSubjectInput, type ChannelSenderSubjectInput, type ApiResourceRefInput, type CollectionDeclarationInput, type FieldDeclarationInput, type UniqueConstraintInput, type UniqueWhereInput, type CheckConstraintInput, type ExistsConstraintInput, type DatastoreGrantInput } from "./datastore.js";
101
106
  export { EnvironmentClient } from "./environment.js";
102
107
  export { type EnvironmentInput } from "./environment.js";
103
108
  export { ExecutionContextClient } from "./executioncontext.js";
104
109
  export { type ExecutionContextInput } from "./executioncontext.js";
105
110
  export { IamPolicyClient } from "./iampolicy.js";
106
- export { type IamPolicyInput, type ApiResourceRefInput } from "./iampolicy.js";
111
+ export { type IamPolicyInput } from "./iampolicy.js";
107
112
  export { IdentityAccountClient } from "./identityaccount.js";
108
113
  export { type IdentityAccountInput } from "./identityaccount.js";
109
114
  export { IdentityProviderClient } from "./identityprovider.js";
@@ -0,0 +1,379 @@
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 { type DeleteResourceInput, type ListParams, type ListResult, type ResourceRef } from "./types.js";
6
+ import { create, fromJson, type JsonValue } from "@bufbuild/protobuf";
7
+ import { ValueSchema } from "@bufbuild/protobuf/wkt";
8
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
9
+ import { DatastoreSchema, type Datastore } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
10
+ import { DatastoreCommandController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/command_pb";
11
+ import { DatastoreQueryController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/query_pb";
12
+ import { DatastoreRecordCommandController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_command_pb";
13
+ import { InsertRecordRequestSchema, RecordEnvelopeSchema, UpdateRecordRequestSchema, DeleteRecordRequestSchema, FindRecordsRequestSchema, RecordListSchema, DescribeDatastoreRequestSchema, DatastoreDescriptionSchema, type InsertRecordRequest, type RecordEnvelope, type UpdateRecordRequest, type DeleteRecordRequest, type FindRecordsRequest, type RecordList, type DescribeDatastoreRequest, type DatastoreDescription } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
14
+ import { DatastoreRecordQueryController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_query_pb";
15
+ import { DatastoreSpecSchema, FieldType, DatastoreVerb, DatastoreGrantScope, DatastoreRoleSchema, ChannelSenderSubjectSchema, DatastoreSubjectSchema, DatastoreRoleBindingSchema, DatastoreAuthorizationSchema, FieldDeclarationSchema, UniqueWhereSchema, UniqueConstraintSchema, CheckConstraintSchema, ExistsConstraintSchema, DatastoreGrantSchema, CollectionDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/spec_pb";
16
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
17
+ import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
18
+ import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
19
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
20
+ import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
21
+ import { ApiResourceRefSchema } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
22
+ import { SearchRequestSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
23
+ import { SearchService } from "@stigmer/protos/ai/stigmer/search/v1/query_pb";
24
+
25
+ /** Provides operations on datastore resources. */
26
+ export class DatastoreClient {
27
+ private readonly command: Client<typeof DatastoreCommandController>;
28
+ private readonly query: Client<typeof DatastoreQueryController>;
29
+ private readonly datastoreRecordCommand: Client<typeof DatastoreRecordCommandController>;
30
+ private readonly datastoreRecordQuery: Client<typeof DatastoreRecordQueryController>;
31
+ private readonly search: Client<typeof SearchService>;
32
+
33
+ constructor(transport: Transport) {
34
+ this.command = createClient(DatastoreCommandController, transport);
35
+ this.query = createClient(DatastoreQueryController, transport);
36
+ this.datastoreRecordCommand = createClient(DatastoreRecordCommandController, transport);
37
+ this.datastoreRecordQuery = createClient(DatastoreRecordQueryController, transport);
38
+ this.search = createClient(SearchService, transport);
39
+ }
40
+
41
+ async apply(input: DatastoreInput): Promise<Datastore> {
42
+ try {
43
+ return await this.command.apply(buildDatastoreProto(input));
44
+ } catch (e) { throw wrapError(e); }
45
+ }
46
+
47
+ async create(input: DatastoreInput): Promise<Datastore> {
48
+ try {
49
+ return await this.command.create(buildDatastoreProto(input));
50
+ } catch (e) { throw wrapError(e); }
51
+ }
52
+
53
+ async update(input: DatastoreInput): Promise<Datastore> {
54
+ try {
55
+ return await this.command.update(buildDatastoreProto(input));
56
+ } catch (e) { throw wrapError(e); }
57
+ }
58
+
59
+ async updateVisibility(input: UpdateVisibilityInput): Promise<Datastore> {
60
+ try {
61
+ return await this.command.updateVisibility(input);
62
+ } catch (e) { throw wrapError(e); }
63
+ }
64
+
65
+ async delete(input: DeleteResourceInput): Promise<Datastore> {
66
+ try {
67
+ return await this.command.delete(create(ApiResourceDeleteInputSchema, {
68
+ resourceId: input.resourceId,
69
+ versionMessage: input.versionMessage,
70
+ force: input.force,
71
+ }));
72
+ } catch (e) { throw wrapError(e); }
73
+ }
74
+
75
+ async get(id: string): Promise<Datastore> {
76
+ try {
77
+ return await this.query.get(create(ApiResourceIdSchema, { value: id }));
78
+ } catch (e) { throw wrapError(e); }
79
+ }
80
+
81
+ async getByReference(ref: ResourceRef): Promise<Datastore> {
82
+ try {
83
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.datastore }));
84
+ } catch (e) { throw wrapError(e); }
85
+ }
86
+
87
+ async insertRecord(input: InsertRecordRequest): Promise<RecordEnvelope> {
88
+ try {
89
+ return await this.datastoreRecordCommand.insertRecord(input);
90
+ } catch (e) { throw wrapError(e); }
91
+ }
92
+
93
+ async updateRecord(input: UpdateRecordRequest): Promise<RecordEnvelope> {
94
+ try {
95
+ return await this.datastoreRecordCommand.updateRecord(input);
96
+ } catch (e) { throw wrapError(e); }
97
+ }
98
+
99
+ async deleteRecord(input: DeleteRecordRequest): Promise<RecordEnvelope> {
100
+ try {
101
+ return await this.datastoreRecordCommand.deleteRecord(input);
102
+ } catch (e) { throw wrapError(e); }
103
+ }
104
+
105
+ async findRecords(input: FindRecordsRequest): Promise<RecordList> {
106
+ try {
107
+ return await this.datastoreRecordQuery.findRecords(input);
108
+ } catch (e) { throw wrapError(e); }
109
+ }
110
+
111
+ async describeDatastore(input: DescribeDatastoreRequest): Promise<DatastoreDescription> {
112
+ try {
113
+ return await this.datastoreRecordQuery.describeDatastore(input);
114
+ } catch (e) { throw wrapError(e); }
115
+ }
116
+
117
+ async list(params: ListParams): Promise<ListResult> {
118
+ try {
119
+ const resp = await this.search.search(create(SearchRequestSchema, {
120
+ kinds: [ApiResourceKind.datastore],
121
+ query: params.query,
122
+ org: params.org,
123
+ excludePublic: params.excludePublic ?? false,
124
+ crossOrgPublic: params.crossOrgPublic ?? false,
125
+ page: params.page ? create(PageInfoSchema, params.page) : undefined,
126
+ }));
127
+ return {
128
+ entries: resp.entries,
129
+ totalCount: resp.totalCount,
130
+ totalPages: resp.totalPages,
131
+ };
132
+ } catch (e) { throw wrapError(e); }
133
+ }
134
+ }
135
+
136
+ /** Input for creating/updating a Datastore. */
137
+ export interface DatastoreInput {
138
+ name: string;
139
+ slug?: string;
140
+ org: string;
141
+ labels?: Record<string, string>;
142
+ visibility?: ApiResourceVisibility;
143
+ description?: string;
144
+ timezone?: string;
145
+ authorization?: DatastoreAuthorizationInput;
146
+ collections?: CollectionDeclarationInput[];
147
+ }
148
+
149
+ /** SDK input type for DatastoreAuthorization. */
150
+ export interface DatastoreAuthorizationInput {
151
+ roles?: DatastoreRoleInput[];
152
+ bindings?: DatastoreRoleBindingInput[];
153
+ defaultRole?: string;
154
+ }
155
+
156
+ /** SDK input type for DatastoreRole. */
157
+ export interface DatastoreRoleInput {
158
+ name: string;
159
+ }
160
+
161
+ /** SDK input type for DatastoreRoleBinding. */
162
+ export interface DatastoreRoleBindingInput {
163
+ subject: DatastoreSubjectInput;
164
+ role: string;
165
+ }
166
+
167
+ /** SDK input type for DatastoreSubject. */
168
+ export interface DatastoreSubjectInput {
169
+ channelSender?: ChannelSenderSubjectInput;
170
+ principal?: ApiResourceRefInput;
171
+ }
172
+
173
+ /** SDK input type for ChannelSenderSubject. */
174
+ export interface ChannelSenderSubjectInput {
175
+ senderKind: string;
176
+ value: string;
177
+ }
178
+
179
+ /** SDK input type for ApiResourceRef. */
180
+ export interface ApiResourceRefInput {
181
+ kind: string;
182
+ id: string;
183
+ relation?: string;
184
+ }
185
+
186
+ /** SDK input type for CollectionDeclaration. */
187
+ export interface CollectionDeclarationInput {
188
+ name: string;
189
+ description?: string;
190
+ fields?: FieldDeclarationInput[];
191
+ uniques?: UniqueConstraintInput[];
192
+ checks?: CheckConstraintInput[];
193
+ exists?: ExistsConstraintInput[];
194
+ notExists?: ExistsConstraintInput[];
195
+ grants?: DatastoreGrantInput[];
196
+ }
197
+
198
+ /** SDK input type for FieldDeclaration. */
199
+ export interface FieldDeclarationInput {
200
+ name: string;
201
+ type: FieldType;
202
+ required?: boolean;
203
+ default?: JsonValue;
204
+ enumValues?: string[];
205
+ description?: string;
206
+ }
207
+
208
+ /** SDK input type for UniqueConstraint. */
209
+ export interface UniqueConstraintInput {
210
+ name: string;
211
+ fields?: string[];
212
+ where?: UniqueWhereInput;
213
+ message: string;
214
+ }
215
+
216
+ /** SDK input type for UniqueWhere. */
217
+ export interface UniqueWhereInput {
218
+ field: string;
219
+ equals: JsonValue;
220
+ }
221
+
222
+ /** SDK input type for CheckConstraint. */
223
+ export interface CheckConstraintInput {
224
+ name: string;
225
+ expression: string;
226
+ when?: string;
227
+ message: string;
228
+ }
229
+
230
+ /** SDK input type for ExistsConstraint. */
231
+ export interface ExistsConstraintInput {
232
+ name: string;
233
+ collection: string;
234
+ where: string;
235
+ when?: string;
236
+ message: string;
237
+ }
238
+
239
+ /** SDK input type for DatastoreGrant. */
240
+ export interface DatastoreGrantInput {
241
+ role: string;
242
+ verbs?: DatastoreVerb[];
243
+ scope?: DatastoreGrantScope;
244
+ }
245
+
246
+ function buildDatastoreRoleProto(input: DatastoreRoleInput) {
247
+ return Object.assign(create(DatastoreRoleSchema), stripUndefined({
248
+ name: input.name,
249
+ }));
250
+ }
251
+
252
+ function buildChannelSenderSubjectProto(input: ChannelSenderSubjectInput) {
253
+ return Object.assign(create(ChannelSenderSubjectSchema), stripUndefined({
254
+ senderKind: input.senderKind,
255
+ value: input.value,
256
+ }));
257
+ }
258
+
259
+ function buildApiResourceRefProto(input: ApiResourceRefInput) {
260
+ return Object.assign(create(ApiResourceRefSchema), stripUndefined({
261
+ kind: input.kind,
262
+ id: input.id,
263
+ relation: input.relation,
264
+ }));
265
+ }
266
+
267
+ function buildDatastoreSubjectProto(input: DatastoreSubjectInput) {
268
+ const msg = create(DatastoreSubjectSchema);
269
+ if (input.channelSender) {
270
+ msg.kind = { case: "channelSender", value: buildChannelSenderSubjectProto(input.channelSender) };
271
+ } else if (input.principal) {
272
+ msg.kind = { case: "principal", value: buildApiResourceRefProto(input.principal) };
273
+ }
274
+ return msg;
275
+ }
276
+
277
+ function buildDatastoreRoleBindingProto(input: DatastoreRoleBindingInput) {
278
+ const msg = create(DatastoreRoleBindingSchema);
279
+ if (input.subject) msg.subject = buildDatastoreSubjectProto(input.subject);
280
+ if (input.role !== undefined) msg.role = input.role;
281
+ return msg;
282
+ }
283
+
284
+ function buildDatastoreAuthorizationProto(input: DatastoreAuthorizationInput) {
285
+ const msg = create(DatastoreAuthorizationSchema);
286
+ if (input.roles) msg.roles = input.roles.map(buildDatastoreRoleProto);
287
+ if (input.bindings) msg.bindings = input.bindings.map(buildDatastoreRoleBindingProto);
288
+ if (input.defaultRole !== undefined) msg.defaultRole = input.defaultRole;
289
+ return msg;
290
+ }
291
+
292
+ function buildFieldDeclarationProto(input: FieldDeclarationInput) {
293
+ const msg = create(FieldDeclarationSchema);
294
+ if (input.name !== undefined) msg.name = input.name;
295
+ if (input.type !== undefined) msg.type = input.type;
296
+ if (input.required !== undefined) msg.required = input.required;
297
+ if (input.default !== undefined) msg.default = fromJson(ValueSchema, input.default);
298
+ if (input.enumValues) msg.enumValues = input.enumValues;
299
+ if (input.description !== undefined) msg.description = input.description;
300
+ return msg;
301
+ }
302
+
303
+ function buildUniqueWhereProto(input: UniqueWhereInput) {
304
+ const msg = create(UniqueWhereSchema);
305
+ if (input.field !== undefined) msg.field = input.field;
306
+ if (input.equals !== undefined) msg.equals = fromJson(ValueSchema, input.equals);
307
+ return msg;
308
+ }
309
+
310
+ function buildUniqueConstraintProto(input: UniqueConstraintInput) {
311
+ const msg = create(UniqueConstraintSchema);
312
+ if (input.name !== undefined) msg.name = input.name;
313
+ if (input.fields) msg.fields = input.fields;
314
+ if (input.where) msg.where = buildUniqueWhereProto(input.where);
315
+ if (input.message !== undefined) msg.message = input.message;
316
+ return msg;
317
+ }
318
+
319
+ function buildCheckConstraintProto(input: CheckConstraintInput) {
320
+ return Object.assign(create(CheckConstraintSchema), stripUndefined({
321
+ name: input.name,
322
+ expression: input.expression,
323
+ when: input.when,
324
+ message: input.message,
325
+ }));
326
+ }
327
+
328
+ function buildExistsConstraintProto(input: ExistsConstraintInput) {
329
+ return Object.assign(create(ExistsConstraintSchema), stripUndefined({
330
+ name: input.name,
331
+ collection: input.collection,
332
+ where: input.where,
333
+ when: input.when,
334
+ message: input.message,
335
+ }));
336
+ }
337
+
338
+ function buildDatastoreGrantProto(input: DatastoreGrantInput) {
339
+ return Object.assign(create(DatastoreGrantSchema), stripUndefined({
340
+ role: input.role,
341
+ verbs: input.verbs,
342
+ scope: input.scope,
343
+ }));
344
+ }
345
+
346
+ function buildCollectionDeclarationProto(input: CollectionDeclarationInput) {
347
+ const msg = create(CollectionDeclarationSchema);
348
+ if (input.name !== undefined) msg.name = input.name;
349
+ if (input.description !== undefined) msg.description = input.description;
350
+ if (input.fields) msg.fields = input.fields.map(buildFieldDeclarationProto);
351
+ if (input.uniques) msg.uniques = input.uniques.map(buildUniqueConstraintProto);
352
+ if (input.checks) msg.checks = input.checks.map(buildCheckConstraintProto);
353
+ if (input.exists) msg.exists = input.exists.map(buildExistsConstraintProto);
354
+ if (input.notExists) msg.notExists = input.notExists.map(buildExistsConstraintProto);
355
+ if (input.grants) msg.grants = input.grants.map(buildDatastoreGrantProto);
356
+ return msg;
357
+ }
358
+
359
+ export function buildDatastoreProto(input: DatastoreInput): Datastore {
360
+ const authorization = input.authorization ? buildDatastoreAuthorizationProto(input.authorization) : undefined;
361
+ const collections = input.collections?.map(buildCollectionDeclarationProto);
362
+ return Object.assign(create(DatastoreSchema), {
363
+ apiVersion: "agentic.stigmer.ai/v1",
364
+ kind: "Datastore",
365
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
366
+ name: input.name,
367
+ org: input.org,
368
+ ...(input.slug && { slug: input.slug }),
369
+ ...(input.labels && { labels: input.labels }),
370
+ ...(input.visibility && { visibility: input.visibility }),
371
+ }),
372
+ spec: Object.assign(create(DatastoreSpecSchema), stripUndefined({
373
+ description: input.description,
374
+ timezone: input.timezone,
375
+ authorization,
376
+ collections,
377
+ })),
378
+ }) as Datastore;
379
+ }
@@ -92,6 +92,7 @@ export interface SessionInput {
92
92
  agentInstanceId?: string;
93
93
  subject?: string;
94
94
  harnessStateId?: string;
95
+ harnessStateIdHistory?: string[];
95
96
  metadata?: Record<string, string>;
96
97
  workspaceEntries?: WorkspaceEntryInput[];
97
98
  mcpServerUsages?: McpServerUsageInput[];
@@ -208,6 +209,7 @@ export function buildSessionProto(input: SessionInput): Session {
208
209
  agentInstanceId: input.agentInstanceId,
209
210
  subject: input.subject,
210
211
  harnessStateId: input.harnessStateId,
212
+ harnessStateIdHistory: input.harnessStateIdHistory,
211
213
  metadata: input.metadata,
212
214
  workspaceEntries,
213
215
  mcpServerUsages,
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ export {
49
49
  getUserMessage,
50
50
  type ErrorReason,
51
51
  getErrorReason,
52
+ getRecordConstraint,
52
53
  type RpcErrorMetadata,
53
54
  annotateRpcError,
54
55
  getRpcMetadata,
@@ -93,6 +94,16 @@ export {
93
94
  type GetCustomerModelPricingParams,
94
95
  } from "./billing.js";
95
96
 
97
+ // Cursor accounts client (platform operators only)
98
+ export {
99
+ CursorAccountsClient,
100
+ type UpsertCursorAccountParams,
101
+ type DeleteCursorAccountParams,
102
+ type AddCursorMemberKeyParams,
103
+ type RemoveCursorMemberKeyParams,
104
+ type SetCursorMemberKeyEnabledParams,
105
+ } from "./cursor-accounts.js";
106
+
96
107
  // Search client
97
108
  export {
98
109
  SearchClient,
@@ -116,6 +127,23 @@ export {
116
127
  type ServerInfo,
117
128
  } from "./platform.js";
118
129
 
130
+ // Manifest engine (kind-agnostic YAML ⇄ proto ⇄ apply)
131
+ export {
132
+ ManifestClient,
133
+ parseManifest,
134
+ serializeManifest,
135
+ manifestKinds,
136
+ manifestHandlerForYamlKind,
137
+ manifestHandlerForTypeName,
138
+ metadataOf,
139
+ REDACTED_SECRET_MARKER,
140
+ containsRedactedSecrets,
141
+ type AppliedManifest,
142
+ type ManifestDocument,
143
+ type ManifestKindHandler,
144
+ type ParseManifestOptions,
145
+ } from "./manifest/index.js";
146
+
119
147
  // Shared types (from generated code)
120
148
  export {
121
149
  type DeleteResourceInput,
@@ -130,6 +158,7 @@ export {
130
158
  // Re-export all resource client classes and input types
131
159
  export {
132
160
  AgentClient,
161
+ buildAgentProto,
133
162
  type AgentInput,
134
163
  type McpServerUsageInput,
135
164
  type ToolApprovalOverrideInput,
@@ -194,6 +223,7 @@ export {
194
223
  } from "./gen/oauthapp.js";
195
224
  export {
196
225
  McpServerClient,
226
+ buildMcpServerProto,
197
227
  type McpServerInput,
198
228
  type StdioServerConfigInput,
199
229
  type HttpServerConfigInput,