@fungi.computer/shiitake 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +454 -2
- package/dist/agar-extension.d.ts +9 -0
- package/dist/agar-extension.js +38 -0
- package/dist/agent-control.d.ts +77 -0
- package/dist/agent-control.js +434 -0
- package/dist/client-entry.d.ts +211 -0
- package/dist/client-entry.js +101 -0
- package/dist/client-wire.d.ts +199 -0
- package/dist/client-wire.js +271 -0
- package/dist/client.d.ts +439 -0
- package/dist/client.js +4 -0
- package/dist/cloudflare.d.ts +220 -0
- package/dist/cloudflare.js +531 -0
- package/dist/effect.d.ts +42 -0
- package/dist/effect.js +20 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.js +81 -0
- package/dist/extension-client.d.ts +38 -0
- package/dist/extension-client.js +56 -0
- package/dist/extension-contract.d.ts +73 -0
- package/dist/extension-contract.js +11 -0
- package/dist/extensions.d.ts +589 -0
- package/dist/extensions.js +263 -0
- package/dist/fleet.d.ts +313 -0
- package/dist/fleet.js +540 -0
- package/dist/hosted.d.ts +133 -0
- package/dist/hosted.js +265 -0
- package/dist/http-routes.d.ts +772 -0
- package/dist/http-routes.js +242 -0
- package/dist/http.d.ts +1 -0
- package/dist/http.js +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +13 -0
- package/dist/internal/accepted-run-executor.d.ts +23 -0
- package/dist/internal/accepted-run-executor.js +129 -0
- package/dist/internal/admission-door.d.ts +75 -0
- package/dist/internal/admission-door.js +105 -0
- package/dist/internal/agent-close.d.ts +4 -0
- package/dist/internal/agent-close.js +42 -0
- package/dist/internal/browser-sessions.d.ts +31 -0
- package/dist/internal/browser-sessions.js +173 -0
- package/dist/internal/client-boundary.d.ts +262 -0
- package/dist/internal/client-boundary.js +202 -0
- package/dist/internal/compaction/compaction.d.ts +54 -0
- package/dist/internal/compaction/compaction.js +291 -0
- package/dist/internal/compaction/session-compaction.d.ts +69 -0
- package/dist/internal/compaction/session-compaction.js +330 -0
- package/dist/internal/compaction/settings.d.ts +11 -0
- package/dist/internal/compaction/settings.js +40 -0
- package/dist/internal/compaction/utils.d.ts +45 -0
- package/dist/internal/compaction/utils.js +319 -0
- package/dist/internal/contracts.d.ts +235 -0
- package/dist/internal/contracts.js +1 -0
- package/dist/internal/coordinator.d.ts +18 -0
- package/dist/internal/coordinator.js +362 -0
- package/dist/internal/document-codec.d.ts +11 -0
- package/dist/internal/document-codec.js +39 -0
- package/dist/internal/effect-client.d.ts +13 -0
- package/dist/internal/effect-client.js +102 -0
- package/dist/internal/effect-contracts.d.ts +236 -0
- package/dist/internal/effect-contracts.js +2 -0
- package/dist/internal/extension-command-registry.d.ts +11 -0
- package/dist/internal/extension-command-registry.js +29 -0
- package/dist/internal/extension-command-tools.d.ts +17 -0
- package/dist/internal/extension-command-tools.js +50 -0
- package/dist/internal/extension-context.d.ts +25 -0
- package/dist/internal/extension-context.js +35 -0
- package/dist/internal/extension-definitions.d.ts +5 -0
- package/dist/internal/extension-definitions.js +6 -0
- package/dist/internal/extension-hook.d.ts +25 -0
- package/dist/internal/extension-hook.js +46 -0
- package/dist/internal/extension-roster.d.ts +23 -0
- package/dist/internal/extension-roster.js +228 -0
- package/dist/internal/extension-runtime.d.ts +63 -0
- package/dist/internal/extension-runtime.js +1004 -0
- package/dist/internal/failure.d.ts +2 -0
- package/dist/internal/failure.js +9 -0
- package/dist/internal/host-meta.d.ts +41 -0
- package/dist/internal/host-meta.js +39 -0
- package/dist/internal/json-value.d.ts +4 -0
- package/dist/internal/json-value.js +3 -0
- package/dist/internal/model-acquisition.d.ts +21 -0
- package/dist/internal/model-acquisition.js +98 -0
- package/dist/internal/model-preference.d.ts +21 -0
- package/dist/internal/model-preference.js +20 -0
- package/dist/internal/observation-kernel.d.ts +28 -0
- package/dist/internal/observation-kernel.js +169 -0
- package/dist/internal/promise-facade.d.ts +18 -0
- package/dist/internal/promise-facade.js +172 -0
- package/dist/internal/run-scope.d.ts +27 -0
- package/dist/internal/run-scope.js +214 -0
- package/dist/internal/runtime-coordinator.d.ts +34 -0
- package/dist/internal/runtime-coordinator.js +233 -0
- package/dist/internal/runtime-core.d.ts +19 -0
- package/dist/internal/runtime-core.js +39 -0
- package/dist/internal/runtime-reconciliation.d.ts +18 -0
- package/dist/internal/runtime-reconciliation.js +162 -0
- package/dist/internal/session-context.d.ts +11 -0
- package/dist/internal/session-context.js +67 -0
- package/dist/internal/session-status.d.ts +10 -0
- package/dist/internal/session-status.js +52 -0
- package/dist/internal/woodstock/agent-reply.d.ts +25 -0
- package/dist/internal/woodstock/agent-reply.js +67 -0
- package/dist/internal/woodstock/client-projection.d.ts +29 -0
- package/dist/internal/woodstock/client-projection.js +512 -0
- package/dist/internal/woodstock/compaction-activity.d.ts +17 -0
- package/dist/internal/woodstock/compaction-activity.js +32 -0
- package/dist/internal/woodstock/cursor.d.ts +9 -0
- package/dist/internal/woodstock/cursor.js +44 -0
- package/dist/internal/woodstock/extension-store.d.ts +72 -0
- package/dist/internal/woodstock/extension-store.js +262 -0
- package/dist/internal/woodstock/fleet-store.d.ts +36 -0
- package/dist/internal/woodstock/fleet-store.js +100 -0
- package/dist/internal/woodstock/identities.d.ts +6 -0
- package/dist/internal/woodstock/identities.js +11 -0
- package/dist/internal/woodstock/index.d.ts +170 -0
- package/dist/internal/woodstock/index.js +546 -0
- package/dist/internal/woodstock/progress.d.ts +32 -0
- package/dist/internal/woodstock/progress.js +89 -0
- package/dist/internal/woodstock/run-recovery.d.ts +8 -0
- package/dist/internal/woodstock/run-recovery.js +95 -0
- package/dist/internal/woodstock/session-attention.d.ts +16 -0
- package/dist/internal/woodstock/session-attention.js +88 -0
- package/dist/internal/woodstock/session-documents.d.ts +18 -0
- package/dist/internal/woodstock/session-documents.js +51 -0
- package/dist/internal/woodstock/session-entry.d.ts +478 -0
- package/dist/internal/woodstock/session-entry.js +484 -0
- package/dist/internal/woodstock/session-grants.d.ts +24 -0
- package/dist/internal/woodstock/session-grants.js +84 -0
- package/dist/internal/woodstock/session-inbox.d.ts +56 -0
- package/dist/internal/woodstock/session-inbox.js +307 -0
- package/dist/internal/woodstock/session-store.d.ts +432 -0
- package/dist/internal/woodstock/session-store.js +2006 -0
- package/dist/internal/woodstock/storage-admission.d.ts +14 -0
- package/dist/internal/woodstock/storage-admission.js +44 -0
- package/dist/model-preference.d.ts +20 -0
- package/dist/model-preference.js +30 -0
- package/dist/node.d.ts +64 -0
- package/dist/node.js +256 -0
- package/dist/remote-client.d.ts +11 -0
- package/dist/remote-client.js +298 -0
- package/dist/session-attention.d.ts +35 -0
- package/dist/session-attention.js +22 -0
- package/dist/session-documents.d.ts +28 -0
- package/dist/session-documents.js +1 -0
- package/dist/testing.d.ts +54 -0
- package/dist/testing.js +215 -0
- package/docs/api/README.md +26 -0
- package/docs/api/agar-extension.md +40 -0
- package/docs/api/agent-control.md +151 -0
- package/docs/api/client-entry.md +344 -0
- package/docs/api/client.md +1112 -0
- package/docs/api/cloudflare.md +500 -0
- package/docs/api/effect.md +884 -0
- package/docs/api/extensions.md +2003 -0
- package/docs/api/fleet.md +734 -0
- package/docs/api/hosted.md +382 -0
- package/docs/api/http.md +111 -0
- package/docs/api/index.md +1116 -0
- package/docs/api/model-preference.md +151 -0
- package/docs/api/node.md +142 -0
- package/docs/api/testing.md +250 -0
- package/package.json +130 -3
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { documentDescriptor } from "./document-codec.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as SchemaRepresentation from "effect/SchemaRepresentation";
|
|
6
|
+
import { ShiitakeError } from "../errors.js";
|
|
7
|
+
import { readDefinition } from "./extension-definitions.js";
|
|
8
|
+
import { extensionFingerprintSchema, extensionIdentifier, extensionRevisionSchema, extensionVersion, } from "../extension-contract.js";
|
|
9
|
+
const maximumRoster = 64;
|
|
10
|
+
const Capability = Schema.Literals([
|
|
11
|
+
"state",
|
|
12
|
+
"attention",
|
|
13
|
+
"settled",
|
|
14
|
+
"send",
|
|
15
|
+
"timers",
|
|
16
|
+
"commands",
|
|
17
|
+
"projection",
|
|
18
|
+
"run_tools",
|
|
19
|
+
"files",
|
|
20
|
+
"prompt",
|
|
21
|
+
"compaction_handoff",
|
|
22
|
+
]);
|
|
23
|
+
const Capabilities = Schema.Array(Capability).pipe(Schema.check(Schema.isMaxLength(10)));
|
|
24
|
+
const ManifestSchema = Schema.Struct({
|
|
25
|
+
protocol: Schema.Literal("shiitake.extension/v0"),
|
|
26
|
+
id: extensionIdentifier,
|
|
27
|
+
version: extensionVersion,
|
|
28
|
+
requests: Capabilities,
|
|
29
|
+
});
|
|
30
|
+
const GrantsSchema = Schema.Array(Schema.Struct({
|
|
31
|
+
id: extensionIdentifier,
|
|
32
|
+
capabilities: Capabilities,
|
|
33
|
+
grantKey: Schema.optionalKey(extensionIdentifier),
|
|
34
|
+
})).pipe(Schema.check(Schema.isMaxLength(maximumRoster)));
|
|
35
|
+
const CollectionName = Schema.String.pipe(Schema.check(Schema.isPattern(/^[a-z][A-Za-z0-9_]{0,63}$/u)));
|
|
36
|
+
const decodeManifest = Schema.decodeUnknownResult(ManifestSchema, {
|
|
37
|
+
onExcessProperty: "error",
|
|
38
|
+
});
|
|
39
|
+
const decodeGrants = Schema.decodeUnknownResult(GrantsSchema, {
|
|
40
|
+
onExcessProperty: "error",
|
|
41
|
+
});
|
|
42
|
+
const decodeCollectionName = Schema.decodeUnknownResult(CollectionName);
|
|
43
|
+
function invalid(message) {
|
|
44
|
+
return new ShiitakeError("extensions", "invalid", message);
|
|
45
|
+
}
|
|
46
|
+
function hasDuplicates(values) {
|
|
47
|
+
return new Set(values).size !== values.length;
|
|
48
|
+
}
|
|
49
|
+
/** JSON with recursively sorted object keys, so equal values hash equally. */
|
|
50
|
+
function canonicalJson(value) {
|
|
51
|
+
return JSON.stringify(value, (_key, nested) => Predicate.isObject(nested)
|
|
52
|
+
? Object.fromEntries(Object.entries(nested).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0))
|
|
53
|
+
: nested);
|
|
54
|
+
}
|
|
55
|
+
/** Hex SHA-256 of UTF-8 text. */
|
|
56
|
+
function sha256Hex(value) {
|
|
57
|
+
return Effect.tryPromise({
|
|
58
|
+
try: async () => {
|
|
59
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
60
|
+
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
61
|
+
},
|
|
62
|
+
catch: () => new ShiitakeError("extensions", "rejected", "Extension digest failed"),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Everything the revision covers: manifest, declared schemas and the hashed
|
|
67
|
+
* config. Functions (keys, migrations, hooks) are covered by the version law.
|
|
68
|
+
*/
|
|
69
|
+
function revisionDescriptor(definition, documents) {
|
|
70
|
+
const { manifest, contract, state, config, catalog } = definition;
|
|
71
|
+
const descriptor = {
|
|
72
|
+
manifest: {
|
|
73
|
+
protocol: manifest.protocol,
|
|
74
|
+
id: manifest.id,
|
|
75
|
+
version: manifest.version,
|
|
76
|
+
requests: [...manifest.requests].sort(),
|
|
77
|
+
},
|
|
78
|
+
commands: Object.fromEntries(Object.entries(contract.commands).map(([name, spec]) => [
|
|
79
|
+
name,
|
|
80
|
+
{
|
|
81
|
+
scope: spec.scope,
|
|
82
|
+
input: SchemaRepresentation.toJson(Schema.toRepresentation(spec.input)),
|
|
83
|
+
output: SchemaRepresentation.toJson(Schema.toRepresentation(spec.output)),
|
|
84
|
+
},
|
|
85
|
+
])),
|
|
86
|
+
projection: contract.projection === null
|
|
87
|
+
? null
|
|
88
|
+
: SchemaRepresentation.toJson(Schema.toRepresentation(contract.projection.schema)),
|
|
89
|
+
state: {
|
|
90
|
+
version: state.version,
|
|
91
|
+
collections: Object.fromEntries(Object.entries(state.collections).map(([name, spec]) => [
|
|
92
|
+
name,
|
|
93
|
+
SchemaRepresentation.toJson(Schema.toRepresentation(spec.schema)),
|
|
94
|
+
])),
|
|
95
|
+
},
|
|
96
|
+
config,
|
|
97
|
+
};
|
|
98
|
+
// An extension without a catalog keeps the revision it had before catalogs.
|
|
99
|
+
const withDocuments = Object.keys(documents).length === 0
|
|
100
|
+
? descriptor
|
|
101
|
+
: {
|
|
102
|
+
...descriptor,
|
|
103
|
+
documents: Object.fromEntries(Object.entries(documents).map(([name, spec]) => [
|
|
104
|
+
name,
|
|
105
|
+
documentDescriptor(spec),
|
|
106
|
+
])),
|
|
107
|
+
};
|
|
108
|
+
return catalog === undefined ? withDocuments : { ...withDocuments, catalog };
|
|
109
|
+
}
|
|
110
|
+
function validateDefinition(definition) {
|
|
111
|
+
const decoded = decodeManifest(definition.manifest);
|
|
112
|
+
if (decoded._tag === "Failure")
|
|
113
|
+
throw invalid("Extension manifest is invalid");
|
|
114
|
+
const manifest = definition.manifest;
|
|
115
|
+
if (hasDuplicates(manifest.requests))
|
|
116
|
+
throw invalid("Extension capability requests are invalid");
|
|
117
|
+
if (definition.contract.id !== manifest.id)
|
|
118
|
+
throw invalid("Extension contract identity does not match its manifest");
|
|
119
|
+
if (!Number.isSafeInteger(definition.state.version) ||
|
|
120
|
+
definition.state.version < 1)
|
|
121
|
+
throw invalid("Extension state version is invalid");
|
|
122
|
+
for (const name of Object.keys(definition.state.collections))
|
|
123
|
+
if (name === "update" ||
|
|
124
|
+
name === "read" ||
|
|
125
|
+
name === "observe" ||
|
|
126
|
+
decodeCollectionName(name)._tag === "Failure")
|
|
127
|
+
throw invalid("Extension collection name is invalid");
|
|
128
|
+
if (definition.catalog !== undefined &&
|
|
129
|
+
!manifest.requests.includes("commands"))
|
|
130
|
+
throw invalid("An extension catalog requires the commands capability");
|
|
131
|
+
return manifest;
|
|
132
|
+
}
|
|
133
|
+
/** Validate a host roster and grants, then derive each revision and fingerprint. */
|
|
134
|
+
export function admitExtensionRosterV0(input) {
|
|
135
|
+
return Effect.gen(function* () {
|
|
136
|
+
const roster = input?.roster ?? [];
|
|
137
|
+
const grantRows = input?.grants ?? [];
|
|
138
|
+
const staged = yield* Effect.try({
|
|
139
|
+
try: () => {
|
|
140
|
+
if (roster.length > maximumRoster)
|
|
141
|
+
throw invalid("Extension roster is invalid");
|
|
142
|
+
const definitions = roster.map((entry) => {
|
|
143
|
+
const definition = readDefinition(entry);
|
|
144
|
+
if (definition === undefined)
|
|
145
|
+
throw invalid("Extension roster entry was not defined");
|
|
146
|
+
const documents = definition.documents ?? {};
|
|
147
|
+
for (const [name, spec] of Object.entries(documents)) {
|
|
148
|
+
if (decodeCollectionName(name)._tag === "Failure")
|
|
149
|
+
throw invalid("Session document name is invalid");
|
|
150
|
+
documentDescriptor(spec);
|
|
151
|
+
}
|
|
152
|
+
const manifest = validateDefinition(definition);
|
|
153
|
+
if (Object.keys(documents).length > 0 &&
|
|
154
|
+
!manifest.requests.includes("state"))
|
|
155
|
+
throw invalid("Session documents require the state capability");
|
|
156
|
+
return { definition, documents, manifest };
|
|
157
|
+
});
|
|
158
|
+
const ids = definitions.map(({ manifest }) => manifest.id);
|
|
159
|
+
if (hasDuplicates(ids))
|
|
160
|
+
throw new ShiitakeError("extensions", "conflict", "Extension identities conflict");
|
|
161
|
+
const grants = decodeGrants(grantRows);
|
|
162
|
+
if (grants._tag === "Failure")
|
|
163
|
+
throw invalid("Extension grants are invalid");
|
|
164
|
+
if (hasDuplicates(grants.success.map(({ id }) => id)))
|
|
165
|
+
throw invalid("Extension grant identities are invalid");
|
|
166
|
+
const grantsById = new Map();
|
|
167
|
+
for (const grant of grants.success) {
|
|
168
|
+
const member = definitions.find(({ manifest }) => manifest.id === grant.id);
|
|
169
|
+
if (member === undefined ||
|
|
170
|
+
hasDuplicates(grant.capabilities) ||
|
|
171
|
+
grant.capabilities.some((capability) => !member.manifest.requests.includes(capability)))
|
|
172
|
+
throw invalid("Extension grant is invalid");
|
|
173
|
+
grantsById.set(grant.id, grant.capabilities);
|
|
174
|
+
}
|
|
175
|
+
const handoffOwners = definitions.filter(({ manifest }) => grantsById.get(manifest.id)?.includes("compaction_handoff"));
|
|
176
|
+
if (handoffOwners.length > 1)
|
|
177
|
+
throw new ShiitakeError("extensions", "conflict", "Compaction handoff slot is already owned");
|
|
178
|
+
const filesOwners = definitions.filter(({ manifest }) => grantsById.get(manifest.id)?.includes("files"));
|
|
179
|
+
if (filesOwners.length > 1)
|
|
180
|
+
throw new ShiitakeError("extensions", "conflict", "Files slot is already owned");
|
|
181
|
+
return definitions
|
|
182
|
+
.map((member) => ({
|
|
183
|
+
...member,
|
|
184
|
+
grants: grantsById.get(member.manifest.id) ?? [],
|
|
185
|
+
}))
|
|
186
|
+
.sort((left, right) => left.manifest.id < right.manifest.id
|
|
187
|
+
? -1
|
|
188
|
+
: left.manifest.id > right.manifest.id
|
|
189
|
+
? 1
|
|
190
|
+
: 0);
|
|
191
|
+
},
|
|
192
|
+
catch: (error) => error instanceof ShiitakeError
|
|
193
|
+
? error
|
|
194
|
+
: invalid("Extension roster is invalid"),
|
|
195
|
+
});
|
|
196
|
+
return yield* Effect.forEach(staged, (member) => Effect.gen(function* () {
|
|
197
|
+
const descriptor = yield* Effect.try({
|
|
198
|
+
try: () => canonicalJson(revisionDescriptor(member.definition, member.documents)),
|
|
199
|
+
catch: () => invalid("Extension schemas cannot be described"),
|
|
200
|
+
});
|
|
201
|
+
const revision = `sha256:${yield* sha256Hex(descriptor)}`;
|
|
202
|
+
const granted = [...member.grants].sort();
|
|
203
|
+
const fingerprint = `sha256:${yield* sha256Hex(canonicalJson([revision, granted]))}`;
|
|
204
|
+
return Object.freeze({
|
|
205
|
+
id: member.manifest.id,
|
|
206
|
+
manifest: member.manifest,
|
|
207
|
+
definition: member.definition,
|
|
208
|
+
documents: member.documents,
|
|
209
|
+
grants: new Set(granted),
|
|
210
|
+
revision: Schema.decodeUnknownSync(extensionRevisionSchema)(revision),
|
|
211
|
+
fingerprint: Schema.decodeUnknownSync(extensionFingerprintSchema)(fingerprint),
|
|
212
|
+
});
|
|
213
|
+
}));
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Hex digest of the core run protocol a run is admitted under, plus the
|
|
218
|
+
* captured Files direct-tool names. It changes when core's
|
|
219
|
+
* run-contract semantics change or the Files tool set changes, never with a
|
|
220
|
+
* roster: the branded Files names are captured separately from fingerprints.
|
|
221
|
+
*/
|
|
222
|
+
export function coreProtocolDigest(fileToolNames) {
|
|
223
|
+
return sha256Hex(canonicalJson({
|
|
224
|
+
protocol: "shiitake.extension/v0",
|
|
225
|
+
runContract: 1,
|
|
226
|
+
fileTools: [...fileToolNames].sort(),
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { WatchdogQueueHead } from "@fungi.computer/watchdog/effect";
|
|
2
|
+
import type { FileTool } from "@fungi.computer/knapsack";
|
|
3
|
+
import type { ModuleRegistration } from "@fungi.computer/mycelium";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { ShiitakeError } from "../errors.js";
|
|
6
|
+
import { type CompactionHandoffV0, type ExtensionFingerprint, type ExtensionId, type ExtensionSlotV0, type ExtensionStatusV0, type Json, type PromptSectionV0, type RunIdentityV0, type SettledRunV0 } from "../extensions.js";
|
|
7
|
+
import type { AdmissionDoor } from "./admission-door.js";
|
|
8
|
+
import type { SqliteOwner } from "./contracts.js";
|
|
9
|
+
import type { AdmittedExtensionV0 } from "./extension-roster.js";
|
|
10
|
+
/** The settled consumer name core itself uses for mail and control repair. */
|
|
11
|
+
export declare const coreConsumer = "core";
|
|
12
|
+
/** Core's generic view of rostered v1 extensions. */
|
|
13
|
+
export type ExtensionRuntime = Readonly<{
|
|
14
|
+
/** Running extensions that participate in runs, with their fingerprints. */
|
|
15
|
+
runParticipants: () => readonly (readonly [
|
|
16
|
+
ExtensionId,
|
|
17
|
+
ExtensionFingerprint
|
|
18
|
+
])[];
|
|
19
|
+
/** Failed pure state migrations make execution unsafe until repaired. */
|
|
20
|
+
incompatibleMigrations: () => readonly ExtensionId[];
|
|
21
|
+
/** Per-run Mycelium modules of the captured participants. */
|
|
22
|
+
modulesForRun: (run: RunIdentityV0, captured: ReadonlySet<string>) => Effect.Effect<readonly ModuleRegistration[], ShiitakeError>;
|
|
23
|
+
/** The exclusive holder's direct Files tools for these captured participants. */
|
|
24
|
+
filesForRun: (run: RunIdentityV0, captured: ReadonlySet<string>) => Effect.Effect<readonly FileTool[], ShiitakeError>;
|
|
25
|
+
/** Ordered, bounded sections rebuilt for every model request. */
|
|
26
|
+
promptSections: (run: RunIdentityV0, captured: ReadonlySet<string>) => Effect.Effect<readonly PromptSectionV0[], ShiitakeError>;
|
|
27
|
+
/** The captured participant's exclusive compaction handoff. */
|
|
28
|
+
compactionHandoff: (captured: ReadonlySet<string>) => CompactionHandoffV0 | undefined;
|
|
29
|
+
/** Running settled consumers and their durable cursors. */
|
|
30
|
+
settledConsumers: () => readonly Readonly<{
|
|
31
|
+
id: string;
|
|
32
|
+
cursor: number;
|
|
33
|
+
}>[];
|
|
34
|
+
/** Deliver each consumer its unseen slice of core-processed runs. */
|
|
35
|
+
deliverSettled: (runs: readonly SettledRunV0[], throughSequence: number) => Effect.Effect<void, ShiitakeError>;
|
|
36
|
+
/** Fire up to 64 due timers; reports whether more may be due. */
|
|
37
|
+
fireDueTimers: (now: number) => Effect.Effect<boolean, ShiitakeError>;
|
|
38
|
+
/** Timer wake state across running extensions. */
|
|
39
|
+
timerWake: (now: number) => Readonly<{
|
|
40
|
+
due: boolean;
|
|
41
|
+
nextWakeAt: number | null;
|
|
42
|
+
}>;
|
|
43
|
+
/** Projection slots for one Session; call inside the snapshot transaction. */
|
|
44
|
+
project: (sessionId: string) => Readonly<Record<string, ExtensionSlotV0>>;
|
|
45
|
+
/** Run one command in its own transaction and return its encoded output. */
|
|
46
|
+
call: (target: Readonly<{
|
|
47
|
+
scope: "session";
|
|
48
|
+
sessionId: string;
|
|
49
|
+
} | {
|
|
50
|
+
scope: "agent";
|
|
51
|
+
}>, extensionId: string, command: string, input: Json) => Effect.Effect<Json, ShiitakeError>;
|
|
52
|
+
list: () => readonly ExtensionStatusV0[];
|
|
53
|
+
resume: (id: string) => Effect.Effect<ExtensionStatusV0, ShiitakeError>;
|
|
54
|
+
close: Effect.Effect<void, ShiitakeError>;
|
|
55
|
+
}>;
|
|
56
|
+
/** Activate the admitted roster and bind it to core's doors and tables. */
|
|
57
|
+
export declare function openExtensionRuntime(input: Readonly<{
|
|
58
|
+
owner: SqliteOwner;
|
|
59
|
+
door: AdmissionDoor;
|
|
60
|
+
readQueueHead: (sessionId: string) => WatchdogQueueHead;
|
|
61
|
+
admitted: readonly AdmittedExtensionV0[];
|
|
62
|
+
requestWake: Effect.Effect<void, ShiitakeError>;
|
|
63
|
+
}>): Effect.Effect<ExtensionRuntime, ShiitakeError>;
|