@constal/sdk 3.4.0 → 3.6.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 CHANGED
@@ -96,6 +96,29 @@ configuration, and control-plane operations. Returned objects are independent
96
96
  copies. A configured operation is not a promise of authorization: Policy still
97
97
  applies when it is invoked.
98
98
 
99
+ ## Agent delivery
100
+
101
+ Bind another Agent Resource to the caller, then address that bound Agent by CRN:
102
+
103
+ ```ts
104
+ const peer = ctx.resources.reviewer;
105
+ const receipt = await ctx.send(peer, { request: "Review this change" },
106
+ { session: "review-123" });
107
+
108
+ const delivery = await ctx.send<{ verdict: string }>(peer,
109
+ { request: "Review this change" }, { completion: "run-result" });
110
+ const answer = await delivery.result;
111
+ ```
112
+
113
+ Each delivery queues a distinct Run in the target Agent's Session. Receipt mode
114
+ requires a Session and acknowledges the durable enqueue; result mode may omit
115
+ the Session to create a fresh one and returns a cancellable Handle for the target
116
+ Run's result. The target executes under the initiating principal's authority.
117
+ Policy evaluates `agent:invoke` on the exact bound target for each new send, and
118
+ the platform rechecks that authority when the target accepts the message.
119
+ Session and Run reads remain separate Policy actions. `ctx.commit` continues to
120
+ address the caller's own ledger.
121
+
99
122
  For model-selected operations, add the optional `resourceTools` to the Agent's
100
123
  ordinary Tool catalog:
101
124
 
@@ -158,4 +181,40 @@ array. Declare its normal `needs` and `maxEffect` when loading uses Resources.
158
181
  source when supplied, and content hash. These are ordinary authorized Tool calls.
159
182
  Skill instructions do not grant additional authority.
160
183
 
161
- See the [Constal documentation](https://constal.ai/docs) for package manifests and deployment workflows.
184
+ ## Model evaluation
185
+
186
+ `ctx.evaluate` judges one state against typed questions through an evaluation
187
+ Model such as `typesafe-ai/jev`. Every question is answered independently with
188
+ constrained values and probabilities, never generated prose, and the call is
189
+ journaled and priced like a model call without consuming a turn.
190
+
191
+ ```ts
192
+ import { agent, noulDecision } from "@constal/sdk";
193
+
194
+ export default agent({
195
+ id: "triage", version: "1.0.0", model: "model",
196
+ async onMessage(ticket, ctx) {
197
+ const { answers } = await ctx.evaluate({
198
+ model: "judge",
199
+ state: { ticket },
200
+ questions: {
201
+ team: { type: "choice", instructions: "Which team owns `ticket`?",
202
+ criteria: { billing: "Charges, invoices, refunds", technical: { what: "Bugs and outages", not_for: "Charges" } } },
203
+ severity: { type: "score", instructions: "How severe is the problem in `ticket`?",
204
+ criteria: ["Cosmetic", "Degraded", "Customer is blocked"] },
205
+ urgent: { type: "noul", instructions: "Does `ticket` convey urgency?" },
206
+ },
207
+ });
208
+ if (answers.team.confidence < 0.5) return { route: "human" };
209
+ return { route: answers.team.choice, severity: answers.severity.score, urgent: noulDecision(answers.urgent, 0.7) };
210
+ },
211
+ });
212
+ ```
213
+
214
+ Bind the evaluation Model like any other (`"judge": "crn:...:model/jev"`), or
215
+ pass `gateway` with an explicit `model` identifier. `instructions`, Choice option
216
+ descriptions, Score levels, and Noul criteria all accept JSON structure. Choice
217
+ answers keep the literal option keys of their criteria, Score answers carry a
218
+ `legend`, and Noul answers are a probability.
219
+
220
+ See [Evaluate state with a Model](https://constal.ai/docs/agents/evaluate) for a complete package manifest, answer shapes, and verification steps.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
5
  "keywords": [
6
6
  "constal",
package/publish/api.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "package": "@constal/sdk",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "exports": [
5
+ "AGENT_UI_DEFAULTS",
5
6
  "Action",
6
7
  "ActionPattern",
7
8
  "Actor",
@@ -13,10 +14,14 @@
13
14
  "Agent",
14
15
  "AgentCredentialSetupRequirement",
15
16
  "AgentDef",
17
+ "AgentDeliveryReceipt",
16
18
  "AgentDeployPolicy",
19
+ "AgentResultDelivery",
20
+ "AgentSendOpts",
17
21
  "AgentSetupMetadata",
18
22
  "AgentSetupRequirement",
19
23
  "AgentSetupWorkflow",
24
+ "AgentUiDeclaration",
20
25
  "AnalyticsClient",
21
26
  "AnalyticsDimensionValue",
22
27
  "AnalyticsEventDefinition",
@@ -71,6 +76,8 @@
71
76
  "CheckpointDeploymentRequest",
72
77
  "CheckpointImportMetadata",
73
78
  "CheckpointImportRequest",
79
+ "ChoiceAnswer",
80
+ "ChoiceQuestion",
74
81
  "CodeScoreResult",
75
82
  "CodeScorerIR",
76
83
  "CodeScorerRule",
@@ -138,6 +145,7 @@
138
145
  "DeliveryReceipt",
139
146
  "DirectNetworkDenied",
140
147
  "DispatchResult",
148
+ "EVALUATION_LIMITS",
141
149
  "EffectCeilingExceeded",
142
150
  "EffectClass",
143
151
  "EvalComparison",
@@ -145,6 +153,17 @@
145
153
  "EvalMode",
146
154
  "EvalSubject",
147
155
  "EvalSubjectSource",
156
+ "EvaluationAnswer",
157
+ "EvaluationAnswerFor",
158
+ "EvaluationAnswers",
159
+ "EvaluationEntry",
160
+ "EvaluationInvocationArgs",
161
+ "EvaluationInvocationResult",
162
+ "EvaluationProtocol",
163
+ "EvaluationQuestion",
164
+ "EvaluationQuestions",
165
+ "EvaluationRecord",
166
+ "EvaluationSpec",
148
167
  "EventBase",
149
168
  "Fact",
150
169
  "FactRef",
@@ -210,6 +229,7 @@
210
229
  "MEMORY_OPERATION_DECLARATIONS",
211
230
  "MODEL_CHECKPOINT_IMPORT_CAPABILITY",
212
231
  "MODEL_COMPLETION_CAPABILITY",
232
+ "MODEL_EVALUATION_CAPABILITY",
213
233
  "ManifestIndexPage",
214
234
  "MapFact",
215
235
  "MapOpts",
@@ -234,12 +254,15 @@
234
254
  "ModelGenerationOptions",
235
255
  "ModelGovernanceControls",
236
256
  "ModelGovernanceMeter",
257
+ "ModelHistoryMessage",
237
258
  "ModelInvocationArgs",
238
259
  "ModelInvocationResult",
239
260
  "ModelTechnicalCapabilities",
240
261
  "ModelTool",
241
262
  "NondeterministicReplay",
242
263
  "NormalizedModelGatewayConfig",
264
+ "NoulAnswer",
265
+ "NoulQuestion",
243
266
  "Out",
244
267
  "OutcomeUnknown",
245
268
  "Over",
@@ -286,6 +309,8 @@
286
309
  "RunStatusDetail",
287
310
  "RunSuiteRequest",
288
311
  "Sandbox",
312
+ "SandboxCommandCollectionError",
313
+ "SandboxCommandExecution",
289
314
  "SandboxCommandResult",
290
315
  "SandboxExecInput",
291
316
  "SandboxFileResult",
@@ -313,6 +338,8 @@
313
338
  "ScopedMemoryStoreRef",
314
339
  "ScopedModelGatewayRef",
315
340
  "ScopedResourceRef",
341
+ "ScoreAnswer",
342
+ "ScoreQuestion",
316
343
  "ScoreRequest",
317
344
  "ScorerApplies",
318
345
  "ScorerCRN",
@@ -386,6 +413,7 @@
386
413
  "TurnGate",
387
414
  "TurnRecord",
388
415
  "TurnSpec",
416
+ "UI_ASSET_CONTENT_TYPES",
389
417
  "UI_BUNDLE_BOUNDS",
390
418
  "UiAccess",
391
419
  "UiBundle",
@@ -414,6 +442,8 @@
414
442
  "agentResourceBinding",
415
443
  "agentSetupMetadata",
416
444
  "agentSetupRequirements",
445
+ "agentUiBundleManifest",
446
+ "agentUiDeclaration",
417
447
  "analyticsEvent",
418
448
  "approximateTokens",
419
449
  "authProvider",
@@ -454,6 +484,9 @@
454
484
  "datasetName",
455
485
  "evaluateCodeScorer",
456
486
  "evaluatePolicyDefinition",
487
+ "evaluationArguments",
488
+ "evaluationProtocolRequest",
489
+ "evaluationProtocolResult",
457
490
  "gateway",
458
491
  "gatewayModelOffer",
459
492
  "gatewayPackageMetadata",
@@ -475,6 +508,7 @@
475
508
  "modelGatewayEndpoint",
476
509
  "modelGenerationOptions",
477
510
  "modelLimit",
511
+ "modelMessages",
478
512
  "modelPrompt",
479
513
  "modelProtocolRequest",
480
514
  "modelProtocolResult",
@@ -482,6 +516,7 @@
482
516
  "normalizeModelGatewayConfig",
483
517
  "normalizeSandboxNetworkPolicy",
484
518
  "normalizeSandboxWorkspacePath",
519
+ "noulDecision",
485
520
  "opTool",
486
521
  "opTools",
487
522
  "parseResourceName",
@@ -506,10 +541,12 @@
506
541
  "scopedBindingKey",
507
542
  "scopedCredentialRef",
508
543
  "scopedResourceRef",
544
+ "scoreLevel",
509
545
  "scorerName",
510
546
  "selectableResourceLabels",
511
547
  "setupAwait",
512
548
  "setupCredentialReceipt",
549
+ "setupPanelProviderIsCrn",
513
550
  "setupScreen",
514
551
  "setupScreenView",
515
552
  "setupSubmission",
@@ -523,6 +560,7 @@
523
560
  "trainingProvider",
524
561
  "trainingProviderMetadata",
525
562
  "trainingRecipe",
563
+ "uiAssetContentType",
526
564
  "uiBundle",
527
565
  "uiBundleManifest",
528
566
  "uiLimit",