@joe-broadhead/opencode-mem 0.9.12 → 0.11.2
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/CHANGELOG.md +1934 -2
- package/README.md +29 -17
- package/SECURITY.md +3 -1
- package/docs/agent-instructions.md +17 -0
- package/docs/agent-protocol.md +8 -8
- package/docs/permissions.md +22 -4
- package/package.json +7923 -217
- package/shared/page-paths.js +44 -0
- package/skills/mem.pages/SKILL.md +8 -1
- package/skills/mem.usage/SKILL.md +15 -15
- package/src/action-grant-keys.js +159 -0
- package/src/action-grant.js +439 -0
- package/src/actions.js +1690 -0
- package/src/backend/records.js +25 -2
- package/src/backend/v3.js +76 -22
- package/src/call-shapes.js +17 -16
- package/src/collector-lock.js +533 -62
- package/src/collector-service.js +153 -26
- package/src/collector.js +627 -33
- package/src/config.js +79 -6
- package/src/connect.js +106 -8
- package/src/credentials.js +123 -25
- package/src/events.js +174 -3
- package/src/forget-turn.js +141 -0
- package/src/host-refusal.js +78 -0
- package/src/index.js +209 -22
- package/src/jobs/host.js +557 -0
- package/src/ops/codes.js +110 -0
- package/src/ops/copy-lineage.js +42 -0
- package/src/ops/index.js +28 -0
- package/src/ops/space-ops.js +1936 -0
- package/src/outlinks.js +103 -0
- package/src/p2-reservation.js +151 -0
- package/src/permissions.js +30 -0
- package/src/plugins/descriptor.js +62 -0
- package/src/plugins/discovery.js +318 -0
- package/src/plugins/grants.js +178 -0
- package/src/plugins/locate.js +319 -0
- package/src/plugins/manifest.js +1162 -0
- package/src/plugins/source-contract/index.js +34 -0
- package/src/plugins/source-contract/policy.js +102 -0
- package/src/plugins/source-contract/vendor/PROVENANCE.json +17 -0
- package/src/plugins/source-contract/vendor/RELEASE-SHA256SUMS +3 -0
- package/src/plugins/source-contract/vendor/RELEASE.json +17 -0
- package/src/plugins/source-contract/vendor/SHA256SUMS +41 -0
- package/src/plugins/source-contract/vendor/THIRD-PARTY-NOTICES.md +35 -0
- package/src/plugins/source-contract/vendor/broker-client.js +93 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-4ERCA4TK.js +185 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ELPJD3ND.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KYWBTAF4.js +182 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-Q3RQA5J2.js +249 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RRUAIQ4I.js +156 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RYNKNCPP.js +165 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/plugins/source-contract/vendor/cursor.js +26 -0
- package/src/plugins/source-contract/vendor/descriptor.js +34 -0
- package/src/plugins/source-contract/vendor/events.js +257 -0
- package/src/plugins/source-contract/vendor/index.js +10 -0
- package/src/plugins/source-contract/vendor/params.js +22 -0
- package/src/plugins/source-contract/vendor/permission.js +28 -0
- package/src/plugins/source-contract/vendor/pick.js +22 -0
- package/src/plugins/source-contract/vendor/read.js +29 -0
- package/src/plugins/source-contract/vendor/registry.js +23 -0
- package/src/plugins/source-contract/vendor/schema.js +17 -0
- package/src/plugins/source-contract/vendor/schemas/output.agenda.json +96 -0
- package/src/plugins/source-contract/vendor/schemas/output.countdown.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.image.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.inbox.json +84 -0
- package/src/plugins/source-contract/vendor/schemas/output.links.json +46 -0
- package/src/plugins/source-contract/vendor/schemas/output.list.json +57 -0
- package/src/plugins/source-contract/vendor/schemas/output.metric.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.note.json +14 -0
- package/src/plugins/source-contract/vendor/schemas/output.progress.json +50 -0
- package/src/plugins/source-contract/vendor/schemas/output.record.json +38 -0
- package/src/plugins/source-contract/vendor/schemas/output.table.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.thread.json +62 -0
- package/src/plugins/source-contract/vendor/schemas/sources.json +819 -0
- package/src/plugins/source-contract/vendor/schemas.js +19 -0
- package/src/plugins/source-contract/vendor/tools-rpc.js +42 -0
- package/src/plugins/verify.js +56 -0
- package/src/protocol.js +21 -5
- package/src/recall.js +104 -5
- package/src/records.js +61 -2
- package/src/requests.js +216 -0
- package/src/runtime.js +89 -7
- package/src/setup-time.js +68 -0
- package/src/skills.js +230 -8
- package/src/source-ids.js +25 -0
- package/src/sources/declaration.js +365 -0
- package/src/sources/reads.js +772 -0
- package/src/sources/rpc.js +151 -0
- package/src/sources.js +409 -90
- package/src/spaces.js +283 -11
- package/src/spool.js +61 -4
- package/src/stated.js +10 -5
- package/src/storable.js +139 -0
- package/src/tools/commitments.js +47 -5
- package/src/tools/held-write.js +36 -13
- package/src/tools/index.js +27 -0
- package/src/tools/ingest.js +27 -2
- package/src/tools/memory.js +52 -14
- package/src/tools/page.js +95 -9
- package/src/tools/recall.js +208 -4
- package/src/tools/records-kit.js +2 -1
- package/src/tools/share.js +42 -3
- package/src/tools/shared.js +44 -4
- package/src/tools/space-lifecycle.js +278 -0
- package/src/tools/spaces.js +373 -29
- package/src/tools/status.js +9 -2
- package/src/tools/wiki.js +34 -4
- package/src/util.js +110 -6
- package/src/vendor/source-contract/README.md +24 -0
- package/src/vendor/source-contract/THIRD-PARTY-NOTICES.md +35 -0
- package/src/vendor/source-contract/VENDOR.json +81 -0
- package/src/vendor/source-contract/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/vendor/source-contract/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/vendor/source-contract/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/vendor/source-contract/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/vendor/source-contract/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/vendor/source-contract/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/vendor/source-contract/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/vendor/source-contract/cursor.js +26 -0
- package/src/vendor/source-contract/events.js +257 -0
- package/src/vendor/source-contract/registry.js +23 -0
- package/src/vendor/source-contract/tools-rpc.js +42 -0
- package/src/views/access-reads.js +256 -0
- package/src/views/communities.js +77 -0
- package/src/views/contracts.js +1183 -36
- package/src/views/inbox-bytes.js +103 -0
- package/src/views/overdue.js +1 -1
- package/src/views/profile.js +31 -0
- package/src/views/receipt.js +81 -0
- package/src/views/records-reads.js +869 -37
- package/src/views/rpc.js +159 -11
- package/src/views/shape.js +8 -5
- package/views/memory.html +16 -3
- package/views/pages.html +2 -2
- package/views/remembered.html +130 -0
package/src/backend/records.js
CHANGED
|
@@ -76,18 +76,39 @@ export function createRecordsClient(config, deps = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* A gateway records request with no credential is not sent, never sent bare:
|
|
81
|
+
* its body is the person's own text, and a bare request would put it on a
|
|
82
|
+
* server under no identity (review B1). Two deployments are where no
|
|
83
|
+
* credential is normal, and the rule leaves both alone: local direct mode,
|
|
84
|
+
* which has no `controlURL` (the bundled stub serves `/records/v1` next to
|
|
85
|
+
* `/v3`), and a client built with no credential chain at all.
|
|
86
|
+
*/
|
|
87
|
+
const credentialRequired = Boolean(config.controlURL) && Boolean(credentials)
|
|
88
|
+
|
|
79
89
|
async function bearer(path) {
|
|
90
|
+
let token
|
|
80
91
|
try {
|
|
81
|
-
|
|
92
|
+
// The request's own destination: the host's identity token is only for
|
|
93
|
+
// its resource's origin (resource-token contract §1).
|
|
94
|
+
token = credentials ? await credentials.bearer(base()) : String(config.token ?? "")
|
|
82
95
|
} catch (error) {
|
|
83
96
|
const status = Number(error?.status) || 0
|
|
84
97
|
throw new RecordsError(path, status, { message: errorMessage(error), cause: error })
|
|
85
98
|
}
|
|
99
|
+
if (!token && credentialRequired) {
|
|
100
|
+
throw new RecordsError(path, 0, {
|
|
101
|
+
errorCode: "MEMORY_SIGN_IN_UNAVAILABLE",
|
|
102
|
+
message: "no Memory credential is available for this gateway, so nothing was sent",
|
|
103
|
+
next: "run /connect and choose Memory, or set the Memory key; nothing was sent",
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
return token
|
|
86
107
|
}
|
|
87
108
|
|
|
88
109
|
async function refreshed(rejected) {
|
|
89
110
|
try {
|
|
90
|
-
return credentials ? await credentials.refresh(rejected) : ""
|
|
111
|
+
return credentials ? await credentials.refresh(rejected, base()) : ""
|
|
91
112
|
} catch {
|
|
92
113
|
return ""
|
|
93
114
|
}
|
|
@@ -542,6 +563,7 @@ function validWriteAnswer(method, answer) {
|
|
|
542
563
|
if (method === "sources.unbind") return count(answer.deleted_events)
|
|
543
564
|
if (method === "sources.request" || method === "sources.report") return Boolean(answer.request && typeof answer.request === "object" && typeof answer.request.source === "string")
|
|
544
565
|
if (method === "sources.cancel") return typeof answer.cancelled === "boolean"
|
|
566
|
+
if (method === "plugins.report") return Array.isArray(answer.plugins)
|
|
545
567
|
if (method === "forgotten.put") return typeof answer.fingerprint?.id === "string" && /^fp_/.test(answer.fingerprint.id)
|
|
546
568
|
if (method === "forgotten.lift") return Array.isArray(answer.lifted) && answer.lifted.every((id) => typeof id === "string")
|
|
547
569
|
return true
|
|
@@ -563,6 +585,7 @@ export const READ_METHODS = Object.freeze(
|
|
|
563
585
|
"events.cursor",
|
|
564
586
|
"events.list",
|
|
565
587
|
"sources.list",
|
|
588
|
+
"plugins.list",
|
|
566
589
|
"review.list",
|
|
567
590
|
"routines.status",
|
|
568
591
|
"space.stats",
|
package/src/backend/v3.js
CHANGED
|
@@ -76,29 +76,58 @@ export function createBackend(config, deps = {}) {
|
|
|
76
76
|
const fetchImpl = deps.fetchImpl ?? globalThis.fetch
|
|
77
77
|
const credentials = deps.credentials ?? null
|
|
78
78
|
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* The bearer for core, gateway, and (without `knowledgeToken`) knowledge
|
|
81
|
+
* requests. The destination is passed through: the identity token is sent
|
|
82
|
+
* only to its resource's origin (resource-token contract §1).
|
|
83
|
+
*/
|
|
80
84
|
const sharedAuth = Object.freeze({
|
|
81
|
-
get: async () => (credentials ? credentials.bearer() : String(config.token ?? "")),
|
|
82
|
-
refresh: async (rejected) => (credentials ? credentials.refresh(rejected) : ""),
|
|
85
|
+
get: async (target) => (credentials ? credentials.bearer(target) : String(config.token ?? "")),
|
|
86
|
+
refresh: async (rejected, target) => (credentials ? credentials.refresh(rejected, target) : ""),
|
|
83
87
|
})
|
|
84
88
|
const knowledgeAuth = config.knowledgeToken
|
|
85
89
|
? Object.freeze({ get: async () => String(config.knowledgeToken), refresh: async () => "" })
|
|
86
90
|
: sharedAuth
|
|
87
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A gateway request with no credential is not sent, never sent bare: its
|
|
94
|
+
* body is the person's own text — a query, or a captured turn the spool is
|
|
95
|
+
* replaying — and a bare request would put that on a server under no
|
|
96
|
+
* identity, which a permissive one then stores and the spool treats as
|
|
97
|
+
* delivered (review B1). Two deployments are where no credential is normal,
|
|
98
|
+
* and the rule leaves both alone: local direct mode, which has no
|
|
99
|
+
* `controlURL` (the bundled stub and a fixed local scope are reached without
|
|
100
|
+
* one), and a backend built with no credential chain at all — a transport
|
|
101
|
+
* test's, or another caller's, which has no identity of this plugin's to fail.
|
|
102
|
+
*/
|
|
103
|
+
const credentialRequired = Boolean(config.controlURL) && Boolean(credentials)
|
|
104
|
+
|
|
88
105
|
/** A credential that cannot be had fails the request, never sends it bare. */
|
|
89
|
-
async function bearerFor(auth, path) {
|
|
106
|
+
async function bearerFor(auth, path, target) {
|
|
107
|
+
let token
|
|
90
108
|
try {
|
|
91
|
-
|
|
109
|
+
token = await auth.get(target)
|
|
92
110
|
} catch (error) {
|
|
93
111
|
const status = Number(error?.status) || 0
|
|
94
112
|
throw new BackendError(path, status, errorMessage(error), status, { cause: error })
|
|
95
113
|
}
|
|
114
|
+
if (!token) guardNoCredential(path)
|
|
115
|
+
return token
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Refuse a gateway request that has no credential to send it under. */
|
|
119
|
+
function guardNoCredential(path) {
|
|
120
|
+
if (!credentialRequired) return
|
|
121
|
+
throw new BackendError(path, 0, "no Memory credential is available for this gateway, so nothing was sent", 0, {
|
|
122
|
+
errorCode: "MEMORY_SIGN_IN_UNAVAILABLE",
|
|
123
|
+
next: "run /connect and choose Memory, or set the Memory key; nothing was sent",
|
|
124
|
+
})
|
|
96
125
|
}
|
|
97
126
|
|
|
98
127
|
/** A different token after a 401, or "" when there is none to try. */
|
|
99
|
-
async function refreshed(auth, rejected) {
|
|
128
|
+
async function refreshed(auth, rejected, target) {
|
|
100
129
|
try {
|
|
101
|
-
return await auth.refresh(rejected)
|
|
130
|
+
return await auth.refresh(rejected, target)
|
|
102
131
|
} catch {
|
|
103
132
|
return ""
|
|
104
133
|
}
|
|
@@ -115,14 +144,20 @@ export function createBackend(config, deps = {}) {
|
|
|
115
144
|
* @param {string} path
|
|
116
145
|
* @param {unknown} body
|
|
117
146
|
* @param {Record<string, string>} requestHeaders
|
|
118
|
-
* @param {{ attempt?: number, auth?: typeof sharedAuth, token?: string, renewed?: boolean, timeoutMs?: number }} [options]
|
|
147
|
+
* @param {{ attempt?: number, auth?: typeof sharedAuth, token?: string, renewed?: boolean, timeoutMs?: number, retries?: number }} [options]
|
|
119
148
|
* @returns {Promise<any>}
|
|
120
149
|
*/
|
|
121
150
|
async function post(baseURL, path, body, requestHeaders, options = {}) {
|
|
122
151
|
const { attempt = 0, auth = sharedAuth, renewed = false } = options
|
|
123
152
|
const timeoutMs = Number(options.timeoutMs) > 0 ? Number(options.timeoutMs) : config.timeoutMs
|
|
124
|
-
|
|
125
|
-
|
|
153
|
+
// A caller with a deadline of its own asks for no retry: one attempt, inside
|
|
154
|
+
// the time it has (the skill refresh, jelly #80).
|
|
155
|
+
const retries = Number.isInteger(options.retries) ? Math.max(0, options.retries) : config.retries
|
|
156
|
+
const token = options.token ?? (await bearerFor(auth, path, baseURL))
|
|
157
|
+
// A retry that was handed an empty token (a 401 whose renewal answered
|
|
158
|
+
// nothing) is not sent either.
|
|
159
|
+
if (!token) guardNoCredential(path)
|
|
160
|
+
const again = (extra) => post(baseURL, path, body, requestHeaders, { attempt, auth, token, renewed, timeoutMs, retries, ...extra })
|
|
126
161
|
const controller = new AbortController()
|
|
127
162
|
const timer = setTimeout(() => controller.abort(), timeoutMs)
|
|
128
163
|
try {
|
|
@@ -133,7 +168,7 @@ export function createBackend(config, deps = {}) {
|
|
|
133
168
|
signal: controller.signal,
|
|
134
169
|
})
|
|
135
170
|
if (response.status === 401 && token && !renewed) {
|
|
136
|
-
const next = await refreshed(auth, token)
|
|
171
|
+
const next = await refreshed(auth, token, baseURL)
|
|
137
172
|
if (next) {
|
|
138
173
|
try {
|
|
139
174
|
await response.body?.cancel()
|
|
@@ -157,7 +192,7 @@ export function createBackend(config, deps = {}) {
|
|
|
157
192
|
if (!response.ok || envelopeFailed) {
|
|
158
193
|
const retryable =
|
|
159
194
|
RETRYABLE_READ_PATHS.has(path) && (response.status >= 500 || response.status === 429)
|
|
160
|
-
if (retryable && attempt <
|
|
195
|
+
if (retryable && attempt < retries) {
|
|
161
196
|
await sleep(150 * 2 ** attempt)
|
|
162
197
|
return again({ attempt: attempt + 1 })
|
|
163
198
|
}
|
|
@@ -170,13 +205,13 @@ export function createBackend(config, deps = {}) {
|
|
|
170
205
|
} catch (error) {
|
|
171
206
|
if (error instanceof BackendError) throw error
|
|
172
207
|
if (error?.name === "AbortError") {
|
|
173
|
-
if (RETRYABLE_READ_PATHS.has(path) && attempt <
|
|
208
|
+
if (RETRYABLE_READ_PATHS.has(path) && attempt < retries) {
|
|
174
209
|
await sleep(150 * 2 ** attempt)
|
|
175
210
|
return again({ attempt: attempt + 1 })
|
|
176
211
|
}
|
|
177
212
|
throw new BackendError(path, 408, `timeout after ${timeoutMs}ms`, 408)
|
|
178
213
|
}
|
|
179
|
-
if (RETRYABLE_READ_PATHS.has(path) && attempt <
|
|
214
|
+
if (RETRYABLE_READ_PATHS.has(path) && attempt < retries) {
|
|
180
215
|
await sleep(150 * 2 ** attempt)
|
|
181
216
|
return again({ attempt: attempt + 1 })
|
|
182
217
|
}
|
|
@@ -197,8 +232,8 @@ export function createBackend(config, deps = {}) {
|
|
|
197
232
|
return rest
|
|
198
233
|
}
|
|
199
234
|
|
|
200
|
-
const core = (path, body, scope, extraHeaders) =>
|
|
201
|
-
post(config.baseURL, path, withoutTask(body), headers(scope, extraHeaders))
|
|
235
|
+
const core = (path, body, scope, extraHeaders, options) =>
|
|
236
|
+
post(config.baseURL, path, withoutTask(body), headers(scope, extraHeaders), options)
|
|
202
237
|
|
|
203
238
|
/** Knowledge assets are not task-scoped: no task header and no task field. */
|
|
204
239
|
function knowledgeHeaders(scope) {
|
|
@@ -296,10 +331,10 @@ export function createBackend(config, deps = {}) {
|
|
|
296
331
|
headers: { "x-tdai-service-id": config.space, ...(token ? { authorization: `Bearer ${token}` } : {}) },
|
|
297
332
|
signal: AbortSignal.timeout(Math.min(config.timeoutMs, 2000)),
|
|
298
333
|
})
|
|
299
|
-
const token = await bearerFor(sharedAuth, "/health")
|
|
334
|
+
const token = await bearerFor(sharedAuth, "/health", config.baseURL)
|
|
300
335
|
let response = await send(token)
|
|
301
336
|
if (response.status === 401 && token) {
|
|
302
|
-
const next = await refreshed(sharedAuth, token)
|
|
337
|
+
const next = await refreshed(sharedAuth, token, config.baseURL)
|
|
303
338
|
if (next) response = await send(next)
|
|
304
339
|
}
|
|
305
340
|
if (!response.ok) throw new BackendError("/health", response.status, response.statusText, response.status)
|
|
@@ -445,6 +480,24 @@ export function createBackend(config, deps = {}) {
|
|
|
445
480
|
return gateway("/v1/capture", body, task, { timeoutMs: config.captureTimeoutMs })
|
|
446
481
|
},
|
|
447
482
|
|
|
483
|
+
/**
|
|
484
|
+
* Remove one capture the gateway stored under `key` (src/forget-turn.js):
|
|
485
|
+
* the turn of the forget's exchange that was delivered before the forget
|
|
486
|
+
* ran. The gateway places it exactly as the capture did and deletes the
|
|
487
|
+
* message ids of its own receipt, so nothing in this request chooses a
|
|
488
|
+
* space. Answers `{ deleted }`; an unknown key answers `{ deleted: 0 }`.
|
|
489
|
+
*
|
|
490
|
+
* @param {{ sessionID: string, visibility: "private"|"team", key: string }} input
|
|
491
|
+
*/
|
|
492
|
+
deleteCapture({ sessionID, visibility, key }) {
|
|
493
|
+
const body = {
|
|
494
|
+
session_id: String(sessionID ?? ""),
|
|
495
|
+
visibility: visibility === "team" ? "team" : "private",
|
|
496
|
+
idempotency_key: String(key ?? ""),
|
|
497
|
+
}
|
|
498
|
+
return gateway("/v1/capture/delete", body, "", { timeoutMs: config.timeoutMs })
|
|
499
|
+
},
|
|
500
|
+
|
|
448
501
|
readCore({ scope }) {
|
|
449
502
|
return core("/v3/core/read", { ...scope }, scope)
|
|
450
503
|
},
|
|
@@ -474,12 +527,13 @@ export function createBackend(config, deps = {}) {
|
|
|
474
527
|
|
|
475
528
|
|
|
476
529
|
|
|
477
|
-
|
|
478
|
-
|
|
530
|
+
/** `retries`/`timeoutMs` let a caller with a deadline read one attempt, in the time it has. */
|
|
531
|
+
listSkills({ scope, retries, timeoutMs } = {}) {
|
|
532
|
+
return core("/v3/skill/list", { filters: {}, pagination: { limit: 100, offset: 0 }, ...scope }, scope, undefined, { retries, timeoutMs })
|
|
479
533
|
},
|
|
480
534
|
|
|
481
|
-
getSkill({ id, scope }) {
|
|
482
|
-
return core("/v3/skill/get", { skill_id: id, include_content: true, ...scope }, scope)
|
|
535
|
+
getSkill({ id, scope, retries, timeoutMs } = {}) {
|
|
536
|
+
return core("/v3/skill/get", { skill_id: id, include_content: true, ...scope }, scope, undefined, { retries, timeoutMs })
|
|
483
537
|
},
|
|
484
538
|
|
|
485
539
|
countScenarios({ scope, pathPrefix }) {
|
package/src/call-shapes.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `mem` namespace's description:
|
|
3
|
-
*
|
|
2
|
+
* The `mem` namespace's description: every taught tool that is not pinned,
|
|
3
|
+
* by name and `action` values, in one line.
|
|
4
4
|
*
|
|
5
5
|
* OpenCode's Code Mode lists a namespace's tool signatures only while its
|
|
6
6
|
* catalog budget lasts. With many plugins installed (Jelly) the `mem` line
|
|
7
7
|
* reads "N tools, M shown": the pinned five always show their full
|
|
8
|
-
* signatures, so this line repeats none of them (0.9.8, FABLE tools 3).
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* signatures, so this line repeats none of them (0.9.8, FABLE tools 3).
|
|
9
|
+
* 0.9.8 carried each tool's arguments here too, because models called with no
|
|
10
|
+
* `action`; 0.10 makes it terse (DESIGN-CRUD §5) after an eval of argument
|
|
11
|
+
* accuracy measured both forms on the gate's model in Code Mode with a
|
|
12
|
+
* Jelly-sized catalogue (`scripts/eval/scenarios-v1-args.mjs`,
|
|
13
|
+
* `scripts/eval/arg-accuracy.mjs`, `docs/evals/arg-accuracy-0.10.md`): the
|
|
14
|
+
* terse line was no worse on any measure (action present 100% vs 100%,
|
|
15
|
+
* arguments valid 100% vs 99% of judged calls, first call valid 96% vs 97% of
|
|
16
|
+
* attempts, and `search` before the first call rose from 20% to 48%). The
|
|
17
|
+
* full schema is one `search` away. Rules live in each tool's description and
|
|
18
|
+
* in the protocol, once each. The collector's tools and the renamed shims are
|
|
19
|
+
* not named, so a model is not invited to call them.
|
|
13
20
|
* `test/call-shapes.test.js` holds this line to the tools' schemas.
|
|
14
21
|
*/
|
|
15
22
|
/**
|
|
@@ -34,7 +41,7 @@ export const WRITE_ACTIONS = Object.freeze({
|
|
|
34
41
|
page: Object.freeze(["write", "append", "replace", "move", "delete"]),
|
|
35
42
|
commitments: Object.freeze(["add", "update", "delete"]),
|
|
36
43
|
share: Object.freeze(["grant", "revoke", "transfer", "copy", "move"]),
|
|
37
|
-
spaces: Object.freeze(["sources", "review"]),
|
|
44
|
+
spaces: Object.freeze(["sources", "jobs", "review", "create", "rename", "archive", "leave", "handover"]),
|
|
38
45
|
wiki: Object.freeze(["create", "write", "append", "delete"]),
|
|
39
46
|
})
|
|
40
47
|
|
|
@@ -45,11 +52,5 @@ export const COLLECTOR_TOOLS = Object.freeze(["ingest", "cursor"])
|
|
|
45
52
|
export const WIKI_DOCUMENTS_NOTE =
|
|
46
53
|
"Search and read documents: uploads, repositories and the pages synthesised from them. Authored knowledge (person, project, decision and runbook pages) goes in mem_page, which keeps its links and is never re-ingested; use wiki for documents."
|
|
47
54
|
|
|
48
|
-
export const MEM_NAMESPACE_DESCRIPTION =
|
|
49
|
-
"Durable memory: records, pages, commitments. Capture keeps prompts and answers, masked.
|
|
50
|
-
'share({action: "list"|"grant"|"revoke"|"transfer"|"copy"|"move", path?, ids?, to?, role?, expires?, space?, rationale?, grant_id?});',
|
|
51
|
-
'spaces({action: "current"|"list"|"members"|"access"|"health"|"profile"|"sources"|"review", space?, bind?, unbind?, confirm?, decide?, limit?});',
|
|
52
|
-
"collect({source?, wait?});",
|
|
53
|
-
'wiki({action: "list"|"search"|"read"|"status"|"create"|"write"|"append"|"delete", query?, wiki_id?, ref?, filename?, name?, content?, ingest?, confirm?}).',
|
|
54
|
-
"Search a tool by name for when to call it.",
|
|
55
|
-
].join(" ")
|
|
55
|
+
export const MEM_NAMESPACE_DESCRIPTION =
|
|
56
|
+
"Durable memory: records, pages, commitments. Capture keeps prompts and answers, masked. Pinned tools list their signatures; others as await tools.mem.<name>({action,...}); search a tool for its arguments: share: list|grant|revoke|transfer|copy|move; spaces: current|list|members|access|health|profile|sources|jobs|review|create|rename|archive|leave|handover; wiki: list|search|read|status|create|write|append|delete; collect({source?, wait?})."
|