@sequenceholdings/agent-spec 0.1.1 → 0.1.3

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 (72) hide show
  1. package/README.md +93 -0
  2. package/dist/agent-definition.d.ts +616 -0
  3. package/dist/agent-definition.js +240 -0
  4. package/dist/canonical-json.d.ts +2 -0
  5. package/dist/canonical-json.js +13 -0
  6. package/dist/index.d.ts +2 -117
  7. package/dist/index.js +2 -248
  8. package/dist/input-schema.d.ts +19 -0
  9. package/dist/input-schema.js +57 -0
  10. package/dist/voice-access.d.ts +40 -0
  11. package/dist/voice-access.js +34 -0
  12. package/dist/voice-actions-contracts.d.ts +423 -0
  13. package/dist/voice-actions-contracts.js +95 -0
  14. package/dist/voice-actions-transitions.d.ts +52 -0
  15. package/dist/voice-actions-transitions.js +170 -0
  16. package/dist/voice-actions.d.ts +2 -0
  17. package/dist/voice-actions.js +2 -0
  18. package/dist/voice-api.d.ts +1102 -0
  19. package/dist/voice-api.js +164 -0
  20. package/dist/voice-authoring.d.ts +463 -0
  21. package/dist/voice-authoring.js +132 -0
  22. package/dist/voice-authority-contracts.d.ts +247 -0
  23. package/dist/voice-authority-contracts.js +177 -0
  24. package/dist/voice-authority-evaluation.d.ts +29 -0
  25. package/dist/voice-authority-evaluation.js +80 -0
  26. package/dist/voice-authority-verification.d.ts +47 -0
  27. package/dist/voice-authority-verification.js +184 -0
  28. package/dist/voice-authority.d.ts +3 -0
  29. package/dist/voice-authority.js +3 -0
  30. package/dist/voice-common.d.ts +21 -0
  31. package/dist/voice-common.js +23 -0
  32. package/dist/voice-drafts.d.ts +441 -0
  33. package/dist/voice-drafts.js +75 -0
  34. package/dist/voice-grant.d.ts +19 -0
  35. package/dist/voice-grant.js +21 -0
  36. package/dist/voice-lifecycle-control.d.ts +130 -0
  37. package/dist/voice-lifecycle-control.js +138 -0
  38. package/dist/voice-lifecycle-session.d.ts +168 -0
  39. package/dist/voice-lifecycle-session.js +114 -0
  40. package/dist/voice-lifecycle-states.d.ts +96 -0
  41. package/dist/voice-lifecycle-states.js +139 -0
  42. package/dist/voice-lifecycle.d.ts +3 -0
  43. package/dist/voice-lifecycle.js +3 -0
  44. package/dist/voice-policy-duration.d.ts +46 -0
  45. package/dist/voice-policy-duration.js +166 -0
  46. package/dist/voice-policy-limits.d.ts +174 -0
  47. package/dist/voice-policy-limits.js +188 -0
  48. package/dist/voice-policy.d.ts +2 -0
  49. package/dist/voice-policy.js +2 -0
  50. package/dist/voice-provider-evidence.d.ts +80 -0
  51. package/dist/voice-provider-evidence.js +115 -0
  52. package/dist/voice-provider-publication.d.ts +319 -0
  53. package/dist/voice-provider-publication.js +117 -0
  54. package/dist/voice-provider-release.d.ts +386 -0
  55. package/dist/voice-provider-release.js +154 -0
  56. package/dist/voice-provider.d.ts +3 -0
  57. package/dist/voice-provider.js +3 -0
  58. package/dist/voice-release.d.ts +808 -0
  59. package/dist/voice-release.js +110 -0
  60. package/dist/voice-runs-audio.d.ts +157 -0
  61. package/dist/voice-runs-audio.js +85 -0
  62. package/dist/voice-runs-evidence.d.ts +183 -0
  63. package/dist/voice-runs-evidence.js +154 -0
  64. package/dist/voice-runs-model.d.ts +967 -0
  65. package/dist/voice-runs-model.js +199 -0
  66. package/dist/voice-runs-tooling.d.ts +88 -0
  67. package/dist/voice-runs-tooling.js +100 -0
  68. package/dist/voice-runs.d.ts +4 -0
  69. package/dist/voice-runs.js +4 -0
  70. package/dist/voice.d.ts +13 -0
  71. package/dist/voice.js +13 -0
  72. package/package.json +8 -3
package/README.md CHANGED
@@ -5,6 +5,12 @@ Preview SDK for authoring typed Sequence agent definitions.
5
5
  The package is versioned independently and its API may change before a stable
6
6
  release. Use Node.js 20 or later.
7
7
 
8
+ Agents is a workflow-agnostic platform primitive. The schema, runtime, and
9
+ deployment path own generic agent capabilities; deployed agent bundles own
10
+ prompts, tools, and product behavior. Primitive code must not branch on an
11
+ agent ID or product identity. See
12
+ [Platform primitive boundaries](../../../docs/platform/platform-primitives.md).
13
+
8
14
  ## Install
9
15
 
10
16
  ```bash
@@ -28,6 +34,40 @@ Definitions must be pure data literals: do not read environment variables, call
28
34
  functions, or compute fields in `agent.ts`. Keep deployment targeting separate
29
35
  from a definition, then use `seq-studio agents validate`, `plan`, and `apply`.
30
36
 
37
+ ## Require a declared dependency
38
+
39
+ Declared MCP servers, skills, and subagents are optional by default: when the
40
+ caller cannot use one, that run proceeds without it and records why. List a
41
+ dependency in `requiredReferences` when the agent must refuse to run, before
42
+ any model call, if it is unavailable:
43
+
44
+ ```ts
45
+ mcpServers: ['support-data'],
46
+ requiredReferences: [{ kind: 'mcp_server', id: 'support-data' }],
47
+ ```
48
+
49
+ Each entry must also be declared in its matching `mcpServers`, `skills`,
50
+ `subagents`, or `managedFunctions` list. Valid kinds are `mcp_server`, `skill`,
51
+ `subagent`, and `managed_function`. `requiredMcpServers` remains supported and
52
+ means the same as listing those servers here.
53
+
54
+ ## Call Managed Functions as tools
55
+
56
+ List Managed Functions by slug (or id) in `managedFunctions` to give the agent
57
+ one tool per function, named `call_function_<slug>`:
58
+
59
+ ```ts
60
+ managedFunctions: ['loan-lookup'],
61
+ requiredReferences: [{ kind: 'managed_function', id: 'loan-lookup' }],
62
+ ```
63
+
64
+ Each call runs as whoever runs the agent: the person in chat, or the step's
65
+ service account in a Lattice process. That principal needs its own `invoker`
66
+ grant on the function; listing a function on an agent never grants it. A run
67
+ with no such identity, such as a Lattice step without
68
+ `run_as.service_account`, gets no function tools and records each function as
69
+ unavailable (`no_user_identity`).
70
+
31
71
  ## Exports
32
72
 
33
73
  - `@sequenceholdings/agent-spec` provides `defineAgent`,
@@ -37,3 +77,56 @@ from a definition, then use `seq-studio agents validate`, `plan`, and `apply`.
37
77
  imports or executes agent source.
38
78
  - `@sequenceholdings/agent-spec/yaml` provides `parseYamlAgent` only for
39
79
  migrating legacy YAML definitions.
80
+
81
+ ## Voice definitions (preview)
82
+
83
+ Choose either `text` or `voice` when creating an Agent. Definitions without `mode` retain their existing text defaults, source format, and bundle hashes. `validateAgentModeUpdate` rejects changing an existing Agent's mode in either direction. Voice uses the same identity, prompt, model, native Skill references, permissions, source compiler, and bundle hashing as text; its supported authoring fields are deliberately smaller.
84
+
85
+ ```ts
86
+ import { defineAgent } from '@sequenceholdings/agent-spec'
87
+
88
+ export const assistant = defineAgent({
89
+ id: '680000000000000000000002',
90
+ name: 'Voice Assistant',
91
+ mode: 'voice',
92
+ model: { provider: 'supported-provider', name: 'supported-model' },
93
+ systemPrompt: 'Be helpful. Answer general questions using these reviewed public facts.',
94
+ skills: ['example-welcome-skill'],
95
+ voice: {
96
+ schemaVersion: '1',
97
+ voice: 'supported-voice',
98
+ language: 'en',
99
+ firstMessage: 'Hello. How can I help?',
100
+ procedures: [{
101
+ key: 'welcome',
102
+ name: 'Welcome',
103
+ instructions: '# Welcome\nAsk how you can help.\n',
104
+ activationDescription: 'When a conversation begins.',
105
+ source: { skillId: 'example-welcome-skill' },
106
+ toolAliases: [],
107
+ subprocedures: [],
108
+ }],
109
+ tools: [],
110
+ },
111
+ })
112
+ ```
113
+
114
+ Model and voice names in this example are placeholders for the server-supported catalog. `validateVoiceAuthoringOptions` checks that catalog; syntactic validation alone does not authorize a model, function, deployment, or call. Runtime identities, environment settings, phone numbers, credentials, provider resources, raw provider configuration, and tool-review assertions are excluded from the authored definition. Text execution settings such as MCP servers, subagents, and framework overrides are rejected on Voice Agents.
115
+
116
+ Each captured procedure preserves exact Markdown, its name, activation description, native source identity, required tool aliases, and local subprocedure references. `contentHash` is recomputed from the captured name and instructions; it is not a native Skill version. Procedure keys, dependency sets, tool aliases, and field mappings have canonical ordering. Duplicate, missing, and cyclic dependencies fail validation. An empty activation description is allowed for a procedure referenced by another declared procedure. Saving a library Skill does not update captured content; an authorized explicit capture/refresh updates a draft. Consumers enforce current source permissions and optimistic revisions before persistence.
117
+
118
+ Authored tools reference an existing Managed Function and operation. Optional input/output mappings support top-level field renames only; input mappings map public `argument` to function `parameter`, and output mappings map function `field` to public `result`. Empty mappings preserve the reviewed operation schema's existing public field names. Publication must validate every mapping against that operation's current input/output schemas and reserved runtime fields. Executable schemas and authority requirements come from the reviewed server catalog, not the author. `projectVoiceAuthoring` produces a deterministic local digest; it makes no promise that a future provider compilation will produce identical output.
119
+
120
+ The root export also provides `VoiceAuthoringService` and `VoiceCallService` interfaces and strict contracts for drafts, publication, call admission, tool authority, verification, action receipts, operator limits, provider evidence, completed runs, and authorized audio responses. Publication validation presents both each concrete function binding and its operation policy; `hashVoiceToolReviewBinding` binds reviewer confirmation to both. These are data contracts and pure validation/transition helpers. Their consumers must implement current authorization, transactional claims, durable idempotency, provider verification, and persistence. A state transition helper does not perform those checks or an external action.
121
+
122
+ Publication validation includes the current deployment revision and active release so consumers can construct a compare-and-swap request. Publication status separately reports the current deployment revision, admission enablement and pause flags. `voiceAgentDisableRequestSchema` accepts only an Agent ID and expected revision; its response contract reports closed admission and preserved pause state. These schemas neither enable a deployment nor cancel existing calls.
123
+
124
+ This package slice supports offline authoring, validation, and export. Generic Agent deployment and ordinary text create/update reject Voice; its dedicated publication path owns provider and runtime authorization. Importing these contracts requires no Voice settings, provider credentials, or database connection. They do not provision resources or enable phone calls.
125
+
126
+ ### Browser audio-read contract
127
+
128
+ Import `voiceAudioReadRequestSchema`, `voiceAudioReadResponseSchema` and
129
+ `voiceAudioCapabilitySchema` from `@sequenceholdings/agent-spec/voice-runs-audio`
130
+ when validating Voice recording metadata in a browser. This narrow entry point
131
+ avoids the Node-only compiler/hash exports at the package root. It defines
132
+ metadata and delivery limits, not provider credentials or an audio transport.