@constal/sdk 1.0.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.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # `@constal/sdk`
2
+
3
+ The public TypeScript SDK for building on Constal.
4
+
5
+ ```sh
6
+ npm install @constal/sdk
7
+ ```
8
+
9
+ The package has one supported import path:
10
+
11
+ ```ts
12
+ import { agent, gateway, credentialProvider } from "@constal/sdk";
13
+ ```
14
+
15
+ Deep imports are not part of the API.
16
+
17
+ ## Public surface
18
+
19
+ The root export contains the contracts needed to author:
20
+
21
+ - Agents, subtasks, Tools, durable state, waits, stages, and ledger views
22
+ - Channels and Auth Providers
23
+ - executable Policies and governance constraints
24
+ - Connection packages through `gateway(...)`, including model, MCP, and Training Provider connections
25
+ - Credential Provider packages through `credentialProvider(...)`
26
+ - Evals, Scorers, training recipes, memory operations, and sandbox handles
27
+ - CRNs, selectors, Resource requirements, schemas, hashes, and recovery-aware errors
28
+
29
+ Connection code receives `GatewayContext`/`IntegrationContext`: declared Credentials, bounded egress, package state, immutable artifact storage, and audit emission. Credential Provider code receives the same bounded capabilities through `CredentialProviderContext`.
30
+
31
+ `gateway(...)` and `credentialProvider(...)` return validated packages suitable for managed deployment. Users implement the package contract; Constal supplies its execution environment.
32
+
33
+ ## Example Connection
34
+
35
+ ```ts
36
+ import { gateway } from "@constal/sdk";
37
+
38
+ export default gateway({
39
+ id: "ticket-connection",
40
+ version: "1.0.0",
41
+ kind: "service",
42
+ displayName: "Ticket connection",
43
+ description: "Read tickets from the configured account.",
44
+ credentialSlots: { account: { title: "Account Credential" } },
45
+ capabilities: [{
46
+ id: "example.ticket-read",
47
+ version: "1",
48
+ hash: "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
49
+ }],
50
+ billing: { upstreamPayer: "tenant" },
51
+ configSchema: { type: "object", additionalProperties: false },
52
+ egress: { rules: [{
53
+ operations: ["ticket.get"],
54
+ origin: "https://api.example.com",
55
+ pathPrefix: "/tickets/",
56
+ methods: ["GET"],
57
+ }] },
58
+ catalog: () => [{
59
+ op: "ticket.get",
60
+ description: "Read one ticket.",
61
+ schema: { type: "object" },
62
+ resultSchema: { type: "object" },
63
+ effect: "read-only",
64
+ recovery: { kind: "repeat" },
65
+ async: false,
66
+ usage: { meter: "none", priceTable: null },
67
+ }],
68
+ async invoke(request, context) {
69
+ const credential = await context.secret("account");
70
+ return context.egress({
71
+ url: `https://api.example.com/tickets/${encodeURIComponent(String((request.args as { id: string }).id))}`,
72
+ method: "GET",
73
+ headers: { authorization: `Bearer ${credential.value}` },
74
+ maximumResponseBytes: 1_048_576,
75
+ maximumRedirects: 0,
76
+ });
77
+ },
78
+ });
79
+ ```
80
+
81
+ See the [Constal documentation](https://constal.ai/docs) for package manifests and deployment workflows.
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@constal/sdk",
3
+ "version": "1.0.0",
4
+ "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
+ "keywords": ["constal", "agents", "integrations", "typescript", "sdk"],
6
+ "license": "UNLICENSED",
7
+ "homepage": "https://constal.ai",
8
+ "type": "module",
9
+ "sideEffects": false,
10
+ "main": "./publish/index.js",
11
+ "types": "./publish/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./publish/index.d.ts",
15
+ "import": "./publish/index.js"
16
+ }
17
+ },
18
+ "files": ["publish"],
19
+ "publishConfig": { "access": "public" },
20
+ "scripts": {
21
+ "build": "node ../../scripts/build-sdk-boundaries.mjs --public-only",
22
+ "test": "vitest run test",
23
+ "typecheck": "tsc -b --pretty false",
24
+ "prepack": "npm run typecheck && npm test && npm run build"
25
+ },
26
+ "devDependencies": {
27
+ "esbuild": "^0.28.2",
28
+ "rollup": "^4.62.4",
29
+ "rollup-plugin-dts": "^6.2.3"
30
+ }
31
+ }
@@ -0,0 +1,402 @@
1
+ {
2
+ "package": "@constal/sdk",
3
+ "version": "1.0.0",
4
+ "exports": [
5
+ "Action",
6
+ "ActionPattern",
7
+ "Actor",
8
+ "AdmissionLimitConstraint",
9
+ "AdmissionLimitInput",
10
+ "AdmissionLimitScope",
11
+ "AdmissionLimitWindow",
12
+ "AfterYield",
13
+ "Agent",
14
+ "AgentDef",
15
+ "AgentDeployPolicy",
16
+ "AnalyticsClient",
17
+ "AnalyticsDimensionValue",
18
+ "AnalyticsEventDefinition",
19
+ "AnalyticsIntent",
20
+ "AnalyticsValues",
21
+ "ApiError",
22
+ "AuthProvider",
23
+ "AuthProviderCRN",
24
+ "AuthProviderContext",
25
+ "AuthProviderRequest",
26
+ "AuthProviderResult",
27
+ "AwaitOpts",
28
+ "BatchSpec",
29
+ "BindingCRN",
30
+ "BindingOwnerScope",
31
+ "BranchRef",
32
+ "CRN",
33
+ "CRNKind",
34
+ "CanonicalEvent",
35
+ "CanonicalEventDraft",
36
+ "CapabilityContractRef",
37
+ "CapabilityGrant",
38
+ "CapabilityRef",
39
+ "CaptureCaseRequest",
40
+ "CaseRow",
41
+ "CatalogTool",
42
+ "Channel",
43
+ "ChannelAlarm",
44
+ "ChannelAlarmResult",
45
+ "ChannelContext",
46
+ "ChannelMessage",
47
+ "ChannelProtocol",
48
+ "ChannelRequest",
49
+ "ChannelResponse",
50
+ "CheckpointDeploymentRequest",
51
+ "CheckpointImportMetadata",
52
+ "CheckpointImportRequest",
53
+ "CodeScoreResult",
54
+ "CodeScorerIR",
55
+ "CodeScorerRule",
56
+ "CommitConflict",
57
+ "CommitGateRejected",
58
+ "CommitOpts",
59
+ "CompareSuitesRequest",
60
+ "Compensation",
61
+ "ConnectionCancelRequest",
62
+ "ConnectionIdentity",
63
+ "ConnectionOperation",
64
+ "ConnectionRecoveryRequest",
65
+ "ConnectionRecoveryResult",
66
+ "ConnectionRequest",
67
+ "ConnectionUsageReport",
68
+ "ControlEvent",
69
+ "Cost",
70
+ "CreateSandboxOptions",
71
+ "CredentialCRN",
72
+ "CredentialDestroyResult",
73
+ "CredentialInteractionAction",
74
+ "CredentialInteractionAdvanceRequest",
75
+ "CredentialInteractionEvent",
76
+ "CredentialInteractionPrimaryAction",
77
+ "CredentialInteractionProof",
78
+ "CredentialInteractionResult",
79
+ "CredentialInteractionStartRequest",
80
+ "CredentialMaterialRequest",
81
+ "CredentialMintRequest",
82
+ "CredentialMintResult",
83
+ "CredentialProviderCRN",
84
+ "CredentialProviderContext",
85
+ "CredentialProviderCredentialSlotSetup",
86
+ "CredentialProviderDefinition",
87
+ "CredentialProviderPackage",
88
+ "CredentialProviderPackageMetadata",
89
+ "CredentialProviderSecretInput",
90
+ "CredentialProviderSetupMetadata",
91
+ "CredentialRevoked",
92
+ "CredentialUnavailable",
93
+ "CredentialVerifyResult",
94
+ "Ctx",
95
+ "CustomerTenantCRN",
96
+ "DataManifest",
97
+ "DatasetCRN",
98
+ "DatasetDraft",
99
+ "DatasetRef",
100
+ "DelegatedGrant",
101
+ "DelegationCeiling",
102
+ "DeliveryMode",
103
+ "DeliveryReceipt",
104
+ "DirectNetworkDenied",
105
+ "DispatchResult",
106
+ "EffectCeilingExceeded",
107
+ "EffectClass",
108
+ "EvalComparison",
109
+ "EvalDivergence",
110
+ "EvalMode",
111
+ "EvalSubject",
112
+ "EvalSubjectSource",
113
+ "EventBase",
114
+ "Fact",
115
+ "FactRef",
116
+ "FileEntry",
117
+ "FixedMemoryStoreRef",
118
+ "FixedModelGatewayRef",
119
+ "FoldFn",
120
+ "GateEvidence",
121
+ "GateExhausted",
122
+ "GateResult",
123
+ "GateVerdict",
124
+ "GatewayCancelRequest",
125
+ "GatewayConfigEgressBinding",
126
+ "GatewayContext",
127
+ "GatewayCredentialSlotSetup",
128
+ "GatewayDefinition",
129
+ "GatewayDiscoverySetup",
130
+ "GatewayModelOffer",
131
+ "GatewayOperation",
132
+ "GatewayPackage",
133
+ "GatewayPackageMetadata",
134
+ "GatewayRecoveryRequest",
135
+ "GatewayRecoveryResult",
136
+ "GatewayRequest",
137
+ "GovernanceContractRef",
138
+ "Handle",
139
+ "HandleOutcome",
140
+ "Hash",
141
+ "HistoryView",
142
+ "IntegrationContext",
143
+ "IntegrationEgressPolicy",
144
+ "IntegrationEgressRequest",
145
+ "IntegrationEgressResponse",
146
+ "IntegrationEgressRule",
147
+ "IntegrationRequestNotSent",
148
+ "IntegrationSecret",
149
+ "IntegrationState",
150
+ "InvokableKind",
151
+ "InvokeOpts",
152
+ "JsonScalar",
153
+ "JsonValue",
154
+ "LabelRequest",
155
+ "LabelSelector",
156
+ "LabelSelectorOperator",
157
+ "LabelSelectorRequirement",
158
+ "LeaseLost",
159
+ "LedgerAddress",
160
+ "LedgerEvent",
161
+ "MCP_CLIENT_CAPABILITY",
162
+ "MEMORY_OPERATION_DECLARATIONS",
163
+ "MODEL_CHECKPOINT_IMPORT_CAPABILITY",
164
+ "MODEL_COMPLETION_CAPABILITY",
165
+ "ManifestIndexPage",
166
+ "MapFact",
167
+ "MapOpts",
168
+ "MemoryDeleteArgs",
169
+ "MemoryGetArgs",
170
+ "MemoryRecord",
171
+ "MemoryRememberArgs",
172
+ "MemorySearchArgs",
173
+ "MemorySearchHit",
174
+ "MemoryStoreBinding",
175
+ "Mode",
176
+ "ModelAdvertisedPricing",
177
+ "ModelCredentialHeader",
178
+ "ModelGatewayBinding",
179
+ "ModelGatewayConfig",
180
+ "ModelGatewayProtocol",
181
+ "ModelGovernanceControls",
182
+ "ModelGovernanceMeter",
183
+ "ModelInvocationArgs",
184
+ "ModelInvocationResult",
185
+ "ModelTechnicalCapabilities",
186
+ "ModelTool",
187
+ "NondeterministicReplay",
188
+ "NormalizedModelGatewayConfig",
189
+ "Out",
190
+ "OutcomeUnknown",
191
+ "Over",
192
+ "PartitionFn",
193
+ "PartitionSpec",
194
+ "Partitioning",
195
+ "PolicyCRN",
196
+ "PolicyConstraint",
197
+ "PolicyConstraintFailed",
198
+ "PolicyContextValue",
199
+ "PolicyDecisionFailed",
200
+ "PolicyDefinition",
201
+ "PolicyInput",
202
+ "PolicyInvocationOrigin",
203
+ "PolicyOutcome",
204
+ "Principal",
205
+ "PrincipalKind",
206
+ "Provenance",
207
+ "Recovery",
208
+ "ReduceFact",
209
+ "ReduceOpts",
210
+ "Ref",
211
+ "RequestLabelRequest",
212
+ "ResourceContractRef",
213
+ "ResourceControlsConstraint",
214
+ "ResourceCredentialBinding",
215
+ "ResourceDisabled",
216
+ "ResourceInvalid",
217
+ "ResourceKind",
218
+ "ResourceName",
219
+ "ResourceNameParts",
220
+ "ResourceNeed",
221
+ "ResourcePattern",
222
+ "ResourceSelector",
223
+ "ResourceUnbound",
224
+ "RollbackReport",
225
+ "RollbackTargetInvalid",
226
+ "RunIdentityView",
227
+ "RunInfo",
228
+ "RunStatusDetail",
229
+ "RunSuiteRequest",
230
+ "Sandbox",
231
+ "SandboxCommandResult",
232
+ "SandboxExecInput",
233
+ "SandboxFileResult",
234
+ "SandboxGovernanceControls",
235
+ "SandboxGovernanceMeter",
236
+ "SandboxImage",
237
+ "SandboxMutationResult",
238
+ "SandboxNetworkMode",
239
+ "SandboxNetworkPolicy",
240
+ "SandboxPool",
241
+ "ScopedBindingKey",
242
+ "ScopedCredentialRef",
243
+ "ScopedMemoryStoreRef",
244
+ "ScopedModelGatewayRef",
245
+ "ScopedResourceRef",
246
+ "ScoreRequest",
247
+ "ScorerApplies",
248
+ "ScorerCRN",
249
+ "ScorerDef",
250
+ "ScorerEvaluation",
251
+ "ScorerKind",
252
+ "ScorerRef",
253
+ "ScorerVerdictIntent",
254
+ "SessionDeleted",
255
+ "SetEvalBaselineRequest",
256
+ "SortField",
257
+ "SpawnCardinality",
258
+ "SpawnOpts",
259
+ "SqlFold",
260
+ "StageInfo",
261
+ "StageOutputSpec",
262
+ "StartTrainingRequest",
263
+ "SteerEvent",
264
+ "SuiteFact",
265
+ "SwallowedYield",
266
+ "TRAINING_PROVIDER_CAPABILITY",
267
+ "TableAggregate",
268
+ "TableDescribeArgs",
269
+ "TableFilter",
270
+ "TableFilterOperation",
271
+ "TableOrder",
272
+ "TableQueryArgs",
273
+ "TableQueryPlan",
274
+ "TableQueryResult",
275
+ "TableScalar",
276
+ "TableSnapshotDescription",
277
+ "Task",
278
+ "TerminalIntegrationFailure",
279
+ "Tier",
280
+ "Tool",
281
+ "ToolCallRecord",
282
+ "ToolUnavailable",
283
+ "TrainingJobFact",
284
+ "TrainingJobReference",
285
+ "TrainingJobState",
286
+ "TrainingJobStatus",
287
+ "TrainingMethod",
288
+ "TrainingModelOffer",
289
+ "TrainingProviderDefinition",
290
+ "TrainingProviderMetadata",
291
+ "TrainingProviderPin",
292
+ "TrainingRecipe",
293
+ "TrainingResumePoint",
294
+ "TrainingUsageUnits",
295
+ "TurnDraft",
296
+ "TurnGate",
297
+ "TurnRecord",
298
+ "TurnSpec",
299
+ "UnknownTool",
300
+ "UpstreamPayer",
301
+ "Verdict",
302
+ "VerdictSamplingMode",
303
+ "ViewDef",
304
+ "WaitResolvedEvent",
305
+ "action",
306
+ "actionPattern",
307
+ "agent",
308
+ "agentResourceBinding",
309
+ "analyticsEvent",
310
+ "approximateTokens",
311
+ "authProvider",
312
+ "authProviderName",
313
+ "bindingName",
314
+ "bucketFor",
315
+ "canonicalJson",
316
+ "capabilityContractRef",
317
+ "casTool",
318
+ "channel",
319
+ "checkpointArtifactRef",
320
+ "checkpointDeploymentRequest",
321
+ "checkpointImportMetadata",
322
+ "checkpointImportRequest",
323
+ "codeScorerIR",
324
+ "credentialInteractionAction",
325
+ "credentialInteractionEvent",
326
+ "credentialInteractionResult",
327
+ "credentialName",
328
+ "credentialProvider",
329
+ "credentialProviderConfigSchema",
330
+ "credentialProviderName",
331
+ "credentialProviderSetupMetadata",
332
+ "credentialRotationDefaults",
333
+ "customerTenantName",
334
+ "cutBatches",
335
+ "cutPartitions",
336
+ "datasetName",
337
+ "evaluateCodeScorer",
338
+ "evaluatePolicyDefinition",
339
+ "gateway",
340
+ "gatewayModelOffer",
341
+ "gatewayPackageMetadata",
342
+ "hash",
343
+ "hashValue",
344
+ "integrationEgressPolicy",
345
+ "labelSelector",
346
+ "matchesAction",
347
+ "matchesLabelSelector",
348
+ "matchesResource",
349
+ "memoryStoreBinding",
350
+ "modelAdvertisedPricing",
351
+ "modelControls",
352
+ "modelGatewayBinding",
353
+ "modelGatewayEndpoint",
354
+ "modelLimit",
355
+ "modelPrompt",
356
+ "modelProtocolRequest",
357
+ "modelProtocolResult",
358
+ "murmur3_32",
359
+ "normalizeModelGatewayConfig",
360
+ "normalizeSandboxNetworkPolicy",
361
+ "opTool",
362
+ "opTools",
363
+ "parseResourceName",
364
+ "policy",
365
+ "policyName",
366
+ "renderTrainingCompletion",
367
+ "resolveGatewayEgress",
368
+ "resourceContractRef",
369
+ "resourceCredentialBinding",
370
+ "resourceLabelMap",
371
+ "resourceName",
372
+ "resourceNeed",
373
+ "resourcePattern",
374
+ "resourceSelector",
375
+ "sandboxControls",
376
+ "sandboxLimit",
377
+ "scopedBindingKey",
378
+ "scopedCredentialRef",
379
+ "scopedResourceRef",
380
+ "scorerName",
381
+ "sha256Hex",
382
+ "stageOutput",
383
+ "startTrainingRequest",
384
+ "subtask",
385
+ "tableDescribe",
386
+ "tableQuery",
387
+ "trainingProvider",
388
+ "trainingProviderMetadata",
389
+ "trainingRecipe",
390
+ "validateBatchSpec",
391
+ "validateFoldFn",
392
+ "validateJsonSchema",
393
+ "validateJsonSchemaDefinition",
394
+ "validatePartitionFn",
395
+ "validatePartitionSpec",
396
+ "validateStageOutputSpec",
397
+ "validateTool",
398
+ "validateView",
399
+ "webFetch",
400
+ "webSearch"
401
+ ]
402
+ }