@inneranimalmedia/agentsam-sdk 2.5.0 → 2.6.1

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 (211) hide show
  1. package/AGENTSAM.md +55 -0
  2. package/README.md +12 -8
  3. package/bin/agentsam +2 -0
  4. package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
  5. package/docs/CLI_SHELL.md +163 -53
  6. package/docs/PLATFORM_RUNTIME_EVENTS.md +48 -0
  7. package/docs/RELEASES.md +16 -7
  8. package/docs/SOURCE_ARCHITECTURE.md +58 -0
  9. package/docs/TEST_TIERS.md +26 -0
  10. package/migrations/runtime/0001_cli_runtime.sql +298 -0
  11. package/package.json +45 -12
  12. package/packages/agentsam-repository/README.md +15 -0
  13. package/packages/agentsam-repository/package.json +25 -0
  14. package/packages/agentsam-repository/src/contracts.js +113 -0
  15. package/packages/agentsam-repository/src/index.js +3 -0
  16. package/{src/lib → packages/agentsam-repository/src}/merkle/cloudflare-persistence.js +14 -24
  17. package/{src/lib → packages/agentsam-repository/src}/merkle/index.js +1 -0
  18. package/{src/lib → packages/agentsam-repository/src}/merkle/persistence.js +6 -4
  19. package/{src/lib → packages/agentsam-repository/src}/merkle/policy.js +1 -0
  20. package/packages/agentsam-repository/test/contracts.test.mjs +40 -0
  21. package/packages/agentsam-repository/test/git-context.test.mjs +24 -0
  22. package/{test/merkle.test.mjs → packages/agentsam-repository/test/merkle-core.test.mjs} +2 -32
  23. package/{test → packages/agentsam-repository/test}/merkle-persistence.test.mjs +11 -6
  24. package/packages/connectors/cloudflare/package.json +10 -0
  25. package/packages/connectors/cloudflare/src/index.js +127 -0
  26. package/packages/connectors/cloudflare/src/owner.js +76 -0
  27. package/packages/connectors/cloudflare/src/routes.js +223 -0
  28. package/packages/connectors/cloudflare/src/vault.js +80 -0
  29. package/packages/connectors/cloudflare/tests/connector.test.mjs +44 -0
  30. package/packages/identity/package.json +2 -2
  31. package/packages/identity/src/contracts/auth-config.js +18 -7
  32. package/packages/identity/tests/auth-config.test.mjs +9 -5
  33. package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
  34. package/protocol/COMPANY_REPOSITORY_GRAPH_V1.md +91 -0
  35. package/protocol/MERKLE_PERSISTENCE_V1.md +2 -0
  36. package/protocol/MERKLE_PERSISTENCE_V2.md +40 -0
  37. package/protocol/README.md +1 -0
  38. package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +19 -0
  39. package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +13 -0
  40. package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +19 -0
  41. package/protocol/capabilities/manifest.json +47 -0
  42. package/protocol/context/context-budget.schema.json +10 -15
  43. package/protocol/context/context-item.schema.json +4 -5
  44. package/protocol/context/resolved-context-pack.schema.json +19 -14
  45. package/protocol/models/README.md +373 -0
  46. package/protocol/models/model-inventory-v2.schema.json +212 -0
  47. package/protocol/repository/repository-contract.schema.json +24 -0
  48. package/protocol/repository/repository-dependency.schema.json +24 -0
  49. package/protocol/repository/repository-identity.schema.json +17 -0
  50. package/protocol/rpc/v1/common.proto +16 -0
  51. package/protocol/rpc/v1/errors.proto +35 -0
  52. package/protocol/rpc/v1/knowledge.proto +77 -0
  53. package/services/knowledge/package-lock.json +333 -0
  54. package/services/knowledge/package.json +5 -1
  55. package/skills/agentsam-cloudflare-workers/SKILL.md +53 -0
  56. package/skills/agentsam-cloudflare-workers/references/cpu-profiling.md +16 -0
  57. package/skills/agentsam-cloudflare-workers/references/errors-and-observability.md +29 -0
  58. package/skills/agentsam-cloudflare-workers/references/wrangler-native-map.md +28 -0
  59. package/skills/catalog.json +18 -0
  60. package/src/agent/capability-adapter.js +25 -13
  61. package/src/agent/index.js +1 -0
  62. package/src/agent/responses-runner.js +353 -0
  63. package/src/capabilities/repository-snapshot.js +3 -3
  64. package/src/cli.js +118 -31
  65. package/src/cloudflare/cpu-profile.js +115 -0
  66. package/src/cloudflare/index.js +14 -0
  67. package/src/cloudflare/wrangler.js +132 -0
  68. package/src/commands/account-auth.js +47 -0
  69. package/src/commands/cloudflare.js +58 -0
  70. package/src/commands/connections.js +93 -0
  71. package/src/commands/context-economics.js +129 -0
  72. package/src/commands/context.js +1 -1
  73. package/src/commands/db.js +20 -3
  74. package/src/commands/deploy.js +39 -3
  75. package/src/commands/env.js +90 -0
  76. package/src/commands/eval.js +63 -0
  77. package/src/commands/interactive.js +2 -5
  78. package/src/commands/knowledge.js +12 -4
  79. package/src/commands/merkle-persist.js +30 -11
  80. package/src/commands/merkle.js +1 -1
  81. package/src/commands/models.js +149 -46
  82. package/src/commands/ollama.js +26 -0
  83. package/src/commands/preferences.js +130 -61
  84. package/src/commands/resume.js +67 -0
  85. package/src/commands/security.js +5 -3
  86. package/src/commands/shell.js +568 -119
  87. package/src/commands/tunnel.js +2 -2
  88. package/src/commands/whoami.js +86 -0
  89. package/src/context/budget.js +68 -6
  90. package/src/context/index.js +3 -1
  91. package/src/context/rehydrate.js +35 -0
  92. package/src/context/resolve.js +44 -12
  93. package/src/errors/contract.js +236 -0
  94. package/src/errors/diagnostic.js +160 -0
  95. package/src/errors/index.js +23 -0
  96. package/src/eval/context.js +191 -0
  97. package/src/eval/index.js +1 -0
  98. package/src/index.js +68 -2
  99. package/src/knowledge/service/auth.js +13 -0
  100. package/src/knowledge/service/grpc-client.js +115 -0
  101. package/src/knowledge/service/grpc-codec.js +237 -0
  102. package/src/knowledge/service/grpc-server.js +83 -0
  103. package/src/knowledge/service/job-engine.js +248 -0
  104. package/src/knowledge/service/server.js +87 -135
  105. package/src/knowledge/source.js +1 -1
  106. package/src/lib/account-session.js +98 -0
  107. package/src/lib/agent-instructions.js +73 -0
  108. package/src/lib/auth.js +4 -0
  109. package/src/lib/cli-preferences.js +55 -24
  110. package/src/lib/deploy/git-guard.js +69 -0
  111. package/src/lib/deploy/health.js +57 -0
  112. package/src/lib/deploy/local-studio.js +283 -0
  113. package/src/lib/deploy/secret-scan.js +65 -0
  114. package/src/lib/deploy-receipt/index.js +2 -2
  115. package/src/lib/detect-context.js +2 -2
  116. package/src/lib/execution-approvals.js +59 -0
  117. package/src/lib/knowledge-docker.js +6 -3
  118. package/src/lib/local-sessions.js +148 -0
  119. package/src/lib/local-status.js +1 -1
  120. package/src/lib/project-config.js +1 -1
  121. package/src/lib/provider-credentials.js +183 -0
  122. package/src/lib/scaffold/templates/worker-api/index.js +101 -20
  123. package/src/lib/scaffold/wizards/worker-api.js +27 -11
  124. package/src/lib/slash-commands.js +23 -16
  125. package/src/local/migrations.js +93 -0
  126. package/src/local/runtime-store.js +141 -0
  127. package/src/local/sqlite.js +2 -0
  128. package/src/local-pty/server.js +113 -51
  129. package/src/models/catalog.js +135 -0
  130. package/src/models/discovery.js +292 -0
  131. package/src/models/index.js +7 -0
  132. package/src/providers/anthropic-messages.js +192 -0
  133. package/src/providers/cloudflare-chat.js +183 -0
  134. package/src/providers/factory.js +69 -0
  135. package/src/providers/gemini-generate-content.js +208 -0
  136. package/src/providers/index.js +10 -0
  137. package/src/providers/ollama-chat.js +148 -0
  138. package/src/providers/openai-responses.js +426 -0
  139. package/src/repository/index.js +14 -2
  140. package/src/rpc/generated/common_grpc_pb.js +1 -0
  141. package/src/rpc/generated/common_pb.js +536 -0
  142. package/src/rpc/generated/errors_grpc_pb.js +1 -0
  143. package/src/rpc/generated/errors_pb.js +482 -0
  144. package/src/rpc/generated/knowledge_grpc_pb.js +135 -0
  145. package/src/rpc/generated/knowledge_pb.js +2168 -0
  146. package/src/rpc/generated/package.json +3 -0
  147. package/src/security/process.js +35 -9
  148. package/src/security/trust-boundary.js +2 -2
  149. package/src/telemetry/contracts.js +203 -0
  150. package/src/telemetry/events.js +51 -0
  151. package/src/telemetry/index.js +8 -0
  152. package/src/tools/hydrate.js +35 -0
  153. package/src/tools/index.js +1 -0
  154. package/src/ui/boot.js +15 -17
  155. package/src/ui/cli/activity.js +76 -0
  156. package/src/ui/cli/compaction.js +15 -0
  157. package/src/ui/cli/footer.js +39 -0
  158. package/src/ui/cli/help.js +192 -0
  159. package/src/ui/cli/plan.js +20 -0
  160. package/src/ui/cli/runtime-events.js +110 -0
  161. package/src/ui/cli/waiting.js +16 -0
  162. package/src/ui/merkle/render.js +1 -1
  163. package/test/account-session.test.mjs +36 -0
  164. package/test/cli/preferences-runtime.test.mjs +11 -0
  165. package/test/cli/runtime-ui.test.mjs +74 -0
  166. package/test/cli-preferences.test.mjs +26 -5
  167. package/test/cloudflare-connector.test.mjs +96 -0
  168. package/test/cloudflare-runtime.test.mjs +75 -0
  169. package/test/context.test.mjs +61 -12
  170. package/test/deploy-health-scan.test.mjs +67 -0
  171. package/test/error-diagnostics.test.mjs +115 -0
  172. package/test/eval-context.test.mjs +37 -0
  173. package/test/execution-approvals.test.mjs +27 -0
  174. package/test/fixtures/knowledge-rpc-worker.mjs +16 -0
  175. package/test/integration/cli-help.test.mjs +37 -0
  176. package/test/integration/knowledge-rpc.test.mjs +112 -0
  177. package/test/integration/merkle-cli.test.mjs +61 -0
  178. package/test/integration/merkle-persistence-identity.test.mjs +48 -0
  179. package/test/integration/provider-env-cli.test.mjs +49 -0
  180. package/test/integration/provider-factory.test.mjs +197 -0
  181. package/test/integration/repository-company-graph.test.mjs +90 -0
  182. package/test/integration/runtime-migrations.test.mjs +82 -0
  183. package/test/knowledge-service.test.mjs +5 -0
  184. package/test/knowledge.test.mjs +16 -0
  185. package/test/live/terminal-transport.live.test.mjs +24 -0
  186. package/test/local-sessions.test.mjs +48 -0
  187. package/test/local-studio-deploy.test.mjs +83 -0
  188. package/test/model-catalog.test.mjs +43 -0
  189. package/test/models.test.mjs +127 -16
  190. package/test/npm10-lock.test.mjs +29 -0
  191. package/test/ollama.test.mjs +21 -0
  192. package/test/openai-responses.test.mjs +95 -0
  193. package/test/portable-context.test.mjs +1 -1
  194. package/test/provider-credentials.test.mjs +96 -0
  195. package/test/rehydrate.test.mjs +25 -0
  196. package/test/release-hygiene.test.mjs +13 -5
  197. package/test/responses-runner.test.mjs +150 -0
  198. package/test/shell.test.mjs +92 -23
  199. package/test/smoke.mjs +4 -1
  200. package/test/telemetry.test.mjs +79 -0
  201. package/test/terminal/local-pty.mock.test.mjs +151 -0
  202. package/test/tools-search.test.mjs +14 -1
  203. package/test/whoami-resume.test.mjs +56 -0
  204. /package/{src/lib → packages/agentsam-repository/src}/git-context.js +0 -0
  205. /package/{src/lib → packages/agentsam-repository/src}/merkle/diff.js +0 -0
  206. /package/{src/lib → packages/agentsam-repository/src}/merkle/filemeta.js +0 -0
  207. /package/{src/lib → packages/agentsam-repository/src}/merkle/git-ignore.js +0 -0
  208. /package/{src/lib → packages/agentsam-repository/src}/merkle/hash.js +0 -0
  209. /package/{src/lib → packages/agentsam-repository/src}/merkle/semantic.js +0 -0
  210. /package/{src/lib → packages/agentsam-repository/src}/merkle/snapshot.js +0 -0
  211. /package/{src/lib → packages/agentsam-repository/src}/merkle/tree.js +0 -0
@@ -0,0 +1,212 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://inneranimalmedia.com/protocol/models/model-inventory-v2.schema.json",
4
+ "title": "AgentSam Model Inventory v2",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "generatedAt", "providers", "models"],
8
+ "properties": {
9
+ "schemaVersion": {
10
+ "const": "agentsam-model-inventory-v2"
11
+ },
12
+ "generatedAt": {
13
+ "type": "string",
14
+ "format": "date-time"
15
+ },
16
+ "selection": {
17
+ "oneOf": [
18
+ { "type": "null" },
19
+ { "$ref": "#/$defs/selection" }
20
+ ]
21
+ },
22
+ "providers": {
23
+ "type": "array",
24
+ "items": { "$ref": "#/$defs/provider" }
25
+ },
26
+ "models": {
27
+ "type": "array",
28
+ "items": { "$ref": "#/$defs/model" }
29
+ }
30
+ },
31
+ "$defs": {
32
+ "provenance": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["sourceKind"],
36
+ "properties": {
37
+ "sourceKind": {
38
+ "enum": [
39
+ "provider_api",
40
+ "provider_published",
41
+ "local_runtime",
42
+ "agentsam_policy",
43
+ "unknown"
44
+ ]
45
+ },
46
+ "sourceRef": { "type": ["string", "null"] },
47
+ "observedAt": { "type": ["string", "null"], "format": "date-time" },
48
+ "pricingAsOf": { "type": ["string", "null"] },
49
+ "status": {
50
+ "enum": ["current", "stale", "unavailable", "unknown"]
51
+ }
52
+ }
53
+ },
54
+ "provider": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["id", "label", "configured", "secretHidden"],
58
+ "properties": {
59
+ "id": { "type": "string", "minLength": 1 },
60
+ "label": { "type": "string", "minLength": 1 },
61
+ "configured": { "type": "boolean" },
62
+ "present": { "type": ["boolean", "null"] },
63
+ "valid": { "type": ["boolean", "null"] },
64
+ "authorized": { "type": ["boolean", "null"] },
65
+ "credentialSourceClass": { "type": ["string", "null"] },
66
+ "credentialPath": { "type": ["string", "null"] },
67
+ "verifiedAt": { "type": ["string", "null"], "format": "date-time" },
68
+ "modelsDiscovered": { "type": ["integer", "null"], "minimum": 0 },
69
+ "secretHidden": { "const": true },
70
+ "error": { "type": ["string", "null"] }
71
+ }
72
+ },
73
+ "priceSet": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "properties": {
77
+ "input": { "type": ["number", "null"], "minimum": 0 },
78
+ "cachedInput": { "type": ["number", "null"], "minimum": 0 },
79
+ "cacheWrite": { "type": ["number", "null"], "minimum": 0 },
80
+ "output": { "type": ["number", "null"], "minimum": 0 }
81
+ }
82
+ },
83
+ "pricing": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": ["currency", "unit", "provenance"],
87
+ "properties": {
88
+ "currency": { "type": "string", "minLength": 1 },
89
+ "unit": { "type": "string", "minLength": 1 },
90
+ "standard": { "$ref": "#/$defs/priceSet" },
91
+ "fast": { "$ref": "#/$defs/priceSet" },
92
+ "flex": { "$ref": "#/$defs/priceSet" },
93
+ "batch": { "$ref": "#/$defs/priceSet" },
94
+ "rules": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "object",
98
+ "additionalProperties": true
99
+ }
100
+ },
101
+ "provenance": { "$ref": "#/$defs/provenance" }
102
+ }
103
+ },
104
+ "providerCapabilities": {
105
+ "type": "object",
106
+ "additionalProperties": true,
107
+ "properties": {
108
+ "contextTokens": { "type": ["integer", "null"], "minimum": 1 },
109
+ "maxOutputTokens": { "type": ["integer", "null"], "minimum": 1 },
110
+ "reasoningEfforts": {
111
+ "type": "array",
112
+ "items": { "type": "string" },
113
+ "uniqueItems": true
114
+ },
115
+ "serviceTiers": {
116
+ "type": "array",
117
+ "items": { "type": "string" },
118
+ "uniqueItems": true
119
+ },
120
+ "modalities": {
121
+ "type": "array",
122
+ "items": { "type": "string" },
123
+ "uniqueItems": true
124
+ },
125
+ "tools": {
126
+ "type": "array",
127
+ "items": { "type": "string" },
128
+ "uniqueItems": true
129
+ }
130
+ }
131
+ },
132
+ "runtimeCompatibility": {
133
+ "type": "object",
134
+ "additionalProperties": true,
135
+ "properties": {
136
+ "interactive": { "type": ["boolean", "null"] },
137
+ "functionCalling": { "type": ["boolean", "null"] },
138
+ "vision": { "type": ["boolean", "null"] },
139
+ "toolLoop": { "type": ["boolean", "null"] },
140
+ "notes": {
141
+ "type": "array",
142
+ "items": { "type": "string" }
143
+ }
144
+ }
145
+ },
146
+ "agentsamPolicy": {
147
+ "type": "object",
148
+ "additionalProperties": true,
149
+ "properties": {
150
+ "recommended": { "type": "boolean" },
151
+ "rank": { "type": ["integer", "null"], "minimum": 1 },
152
+ "tags": {
153
+ "type": "array",
154
+ "items": { "type": "string" },
155
+ "uniqueItems": true
156
+ },
157
+ "workingContextTarget": { "type": ["integer", "null"], "minimum": 1 },
158
+ "compactAt": { "type": ["integer", "null"], "minimum": 1 },
159
+ "interveneAt": { "type": ["integer", "null"], "minimum": 1 }
160
+ }
161
+ },
162
+ "model": {
163
+ "type": "object",
164
+ "additionalProperties": false,
165
+ "required": [
166
+ "provider",
167
+ "modelId",
168
+ "available",
169
+ "providerCapabilities",
170
+ "runtimeCompatibility",
171
+ "provenance",
172
+ "agentsam"
173
+ ],
174
+ "properties": {
175
+ "provider": { "type": "string", "minLength": 1 },
176
+ "modelId": { "type": "string", "minLength": 1 },
177
+ "label": { "type": ["string", "null"] },
178
+ "available": { "type": "boolean" },
179
+ "providerCapabilities": { "$ref": "#/$defs/providerCapabilities" },
180
+ "runtimeCompatibility": { "$ref": "#/$defs/runtimeCompatibility" },
181
+ "pricing": {
182
+ "oneOf": [
183
+ { "type": "null" },
184
+ { "$ref": "#/$defs/pricing" }
185
+ ]
186
+ },
187
+ "provenance": {
188
+ "type": "object",
189
+ "additionalProperties": false,
190
+ "required": ["availability", "capabilities"],
191
+ "properties": {
192
+ "availability": { "$ref": "#/$defs/provenance" },
193
+ "capabilities": { "$ref": "#/$defs/provenance" }
194
+ }
195
+ },
196
+ "agentsam": { "$ref": "#/$defs/agentsamPolicy" }
197
+ }
198
+ },
199
+ "selection": {
200
+ "type": "object",
201
+ "additionalProperties": false,
202
+ "required": ["provider", "modelId"],
203
+ "properties": {
204
+ "provider": { "type": "string", "minLength": 1 },
205
+ "modelId": { "type": "string", "minLength": 1 },
206
+ "reasoningEffort": { "type": ["string", "null"] },
207
+ "serviceTier": { "type": ["string", "null"] },
208
+ "selectedAt": { "type": ["string", "null"], "format": "date-time" }
209
+ }
210
+ }
211
+ }
212
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.inneranimalmedia.com/agentsam/repository/repository-contract.schema.json",
4
+ "title": "AgentSam Repository Contract Record",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "id", "account_id", "repository_id", "contract_key", "contract_version", "contract_type", "name", "contract_hash", "status"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "id": { "type": "string", "minLength": 1 },
11
+ "account_id": { "type": "string", "minLength": 1 },
12
+ "repository_id": { "type": "string", "minLength": 1 },
13
+ "contract_key": { "type": "string", "minLength": 1 },
14
+ "contract_version": { "type": "string", "minLength": 1 },
15
+ "contract_type": { "enum": ["api", "schema", "runtime", "cli", "event", "receipt", "package"] },
16
+ "name": { "type": "string", "minLength": 1 },
17
+ "description": { "type": ["string", "null"] },
18
+ "manifest_path": { "type": ["string", "null"] },
19
+ "contract_hash": { "type": "string", "minLength": 1 },
20
+ "status": { "enum": ["active", "deprecated", "retired"] },
21
+ "created_at": { "type": ["integer", "null"], "minimum": 0 },
22
+ "updated_at": { "type": ["integer", "null"], "minimum": 0 }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.inneranimalmedia.com/agentsam/repository/repository-dependency.schema.json",
4
+ "title": "AgentSam Repository Dependency Record",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "id", "account_id", "source_repository_id", "target_repository_id", "dependency_type", "criticality", "failure_policy"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "id": { "type": "string", "minLength": 1 },
11
+ "account_id": { "type": "string", "minLength": 1 },
12
+ "source_repository_id": { "type": "string", "minLength": 1 },
13
+ "target_repository_id": { "type": "string", "minLength": 1 },
14
+ "dependency_type": { "enum": ["runtime", "build", "contract", "package", "deploy", "tool", "data"] },
15
+ "contract_id": { "type": ["string", "null"] },
16
+ "criticality": { "enum": ["informational", "compatible", "strict", "critical"] },
17
+ "required_version": { "type": ["string", "null"] },
18
+ "required_contract_hash": { "type": ["string", "null"] },
19
+ "failure_policy": { "enum": ["warn", "block_certification", "block_deploy", "degrade"] },
20
+ "description": { "type": ["string", "null"] },
21
+ "created_at": { "type": ["integer", "null"], "minimum": 0 },
22
+ "updated_at": { "type": ["integer", "null"], "minimum": 0 }
23
+ }
24
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.inneranimalmedia.com/agentsam/repository/repository-identity.schema.json",
4
+ "title": "AgentSam Repository Identity",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "repository_id", "full_name", "role", "default_branch", "status"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "repository_id": { "type": "string", "minLength": 1 },
11
+ "full_name": { "type": "string", "minLength": 1 },
12
+ "role": { "type": "string", "minLength": 1 },
13
+ "default_branch": { "type": "string", "minLength": 1 },
14
+ "canonical_url": { "type": ["string", "null"] },
15
+ "status": { "enum": ["active", "archived", "disabled"] }
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ syntax = "proto3";
2
+
3
+ package agentsam.knowledge.v1;
4
+
5
+ message JobId {
6
+ string value = 1;
7
+ }
8
+
9
+ message RepositoryRef {
10
+ string alias = 1;
11
+ string repository_id = 2;
12
+ }
13
+
14
+ message StringList {
15
+ repeated string values = 1;
16
+ }
@@ -0,0 +1,35 @@
1
+ syntax = "proto3";
2
+
3
+ package agentsam.knowledge.v1;
4
+
5
+ // Numeric values intentionally match google.rpc.Code / gRPC canonical status codes.
6
+ enum ErrorCode {
7
+ ERROR_CODE_OK = 0;
8
+ ERROR_CODE_CANCELLED = 1;
9
+ ERROR_CODE_UNKNOWN = 2;
10
+ ERROR_CODE_INVALID_ARGUMENT = 3;
11
+ ERROR_CODE_DEADLINE_EXCEEDED = 4;
12
+ ERROR_CODE_NOT_FOUND = 5;
13
+ ERROR_CODE_ALREADY_EXISTS = 6;
14
+ ERROR_CODE_PERMISSION_DENIED = 7;
15
+ ERROR_CODE_RESOURCE_EXHAUSTED = 8;
16
+ ERROR_CODE_FAILED_PRECONDITION = 9;
17
+ ERROR_CODE_ABORTED = 10;
18
+ ERROR_CODE_OUT_OF_RANGE = 11;
19
+ ERROR_CODE_UNIMPLEMENTED = 12;
20
+ ERROR_CODE_INTERNAL = 13;
21
+ ERROR_CODE_UNAVAILABLE = 14;
22
+ ERROR_CODE_DATA_LOSS = 15;
23
+ ERROR_CODE_UNAUTHENTICATED = 16;
24
+ }
25
+
26
+ message ErrorDetail {
27
+ ErrorCode code = 1;
28
+ string message = 2;
29
+ bool retryable = 3;
30
+ string reason = 4;
31
+ optional uint32 http_status = 5;
32
+ optional uint32 retry_after_ms = 6;
33
+ optional string provider = 7;
34
+ optional string provider_code = 8;
35
+ }
@@ -0,0 +1,77 @@
1
+ syntax = "proto3";
2
+
3
+ package agentsam.knowledge.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+ import "errors.proto";
8
+
9
+ service KnowledgeService {
10
+ rpc ListRepositories(ListRepositoriesRequest) returns (ListRepositoriesResponse);
11
+ rpc SubmitJob(SubmitJobRequest) returns (Job);
12
+ rpc GetJob(GetJobRequest) returns (Job);
13
+ rpc WatchJob(WatchJobRequest) returns (stream JobEvent);
14
+ }
15
+
16
+ message ListRepositoriesRequest {}
17
+
18
+ message ListRepositoriesResponse {
19
+ repeated RepositoryRef repositories = 1;
20
+ bool embeddings_enabled = 2;
21
+ }
22
+
23
+ enum JobOperation {
24
+ JOB_OPERATION_UNSPECIFIED = 0;
25
+ JOB_OPERATION_INDEX = 1;
26
+ JOB_OPERATION_PLAN = 2;
27
+ JOB_OPERATION_SEARCH = 3;
28
+ }
29
+
30
+ enum JobStatus {
31
+ JOB_STATUS_UNSPECIFIED = 0;
32
+ JOB_STATUS_QUEUED = 1;
33
+ JOB_STATUS_RUNNING = 2;
34
+ JOB_STATUS_COMPLETED = 3;
35
+ JOB_STATUS_FAILED = 4;
36
+ }
37
+
38
+ message SubmitJobRequest {
39
+ string repository = 1;
40
+ JobOperation operation = 2;
41
+ optional string scope = 3;
42
+ StringList include = 4;
43
+ StringList exclude = 5;
44
+ optional bool embed = 6;
45
+ optional bool semantic = 7;
46
+ optional string query = 8;
47
+ optional uint32 top_k = 9;
48
+ optional uint32 token_budget = 10;
49
+ optional string generation_id = 11;
50
+ optional uint32 max_inputs = 12;
51
+ optional uint32 max_characters = 13;
52
+ optional string idempotency_key = 14;
53
+ }
54
+
55
+ message GetJobRequest {
56
+ JobId job_id = 1;
57
+ }
58
+
59
+ message WatchJobRequest {
60
+ JobId job_id = 1;
61
+ }
62
+
63
+ message Job {
64
+ JobId id = 1;
65
+ JobStatus status = 2;
66
+ uint32 attempts = 3;
67
+ google.protobuf.Timestamp created_at = 4;
68
+ google.protobuf.Timestamp updated_at = 5;
69
+ string result_json = 6;
70
+ ErrorDetail failure = 7;
71
+ }
72
+
73
+ message JobEvent {
74
+ Job job = 1;
75
+ google.protobuf.Timestamp observed_at = 2;
76
+ uint64 sequence = 3;
77
+ }