@fungi.computer/shiitake 0.0.1 → 0.2.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/dist/fleet.d.ts +12 -12
- package/dist/fleet.js +16 -16
- package/dist/internal/admission-door.js +1 -1
- package/dist/internal/compaction/compaction.d.ts +1 -1
- package/dist/internal/compaction/compaction.js +5 -6
- package/dist/internal/compaction/session-compaction.js +1 -1
- package/dist/internal/coordinator.js +1 -1
- package/docs/api/effect.md +0 -20
- package/package.json +6 -6
package/dist/fleet.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const agentActionSchema: z.ZodEnum<{
|
|
|
20
20
|
/** One host-admitted fleet operation. */
|
|
21
21
|
export type AgentAction = z.infer<typeof agentActionSchema>;
|
|
22
22
|
/** Attribution supplied by the admitting host, without Team semantics. */
|
|
23
|
-
export declare const agentProvenanceSchema: z.ZodObject<{
|
|
23
|
+
export declare const agentProvenanceSchema: z.ZodLazy<z.ZodObject<{
|
|
24
24
|
actor: z.ZodString;
|
|
25
25
|
workflowRunId: z.ZodOptional<z.ZodString>;
|
|
26
26
|
toolCallInputDigest: z.ZodOptional<z.ZodString>;
|
|
@@ -28,9 +28,9 @@ export declare const agentProvenanceSchema: z.ZodObject<{
|
|
|
28
28
|
agentId: z.ZodString;
|
|
29
29
|
sessionId: z.ZodString;
|
|
30
30
|
}, z.core.$strict>>;
|
|
31
|
-
}, z.core.$strict
|
|
31
|
+
}, z.core.$strict>>;
|
|
32
32
|
/** Fleet authority is supplied, never looked up in host policy. */
|
|
33
|
-
export declare const agentGrantSchema: z.ZodObject<{
|
|
33
|
+
export declare const agentGrantSchema: z.ZodLazy<z.ZodObject<{
|
|
34
34
|
agents: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
35
35
|
actions: z.ZodArray<z.ZodEnum<{
|
|
36
36
|
send: "send";
|
|
@@ -40,7 +40,7 @@ export declare const agentGrantSchema: z.ZodObject<{
|
|
|
40
40
|
delegate: "delegate";
|
|
41
41
|
}>>;
|
|
42
42
|
expiresAt: z.ZodNumber;
|
|
43
|
-
provenance: z.ZodObject<{
|
|
43
|
+
provenance: z.ZodLazy<z.ZodObject<{
|
|
44
44
|
actor: z.ZodString;
|
|
45
45
|
workflowRunId: z.ZodOptional<z.ZodString>;
|
|
46
46
|
toolCallInputDigest: z.ZodOptional<z.ZodString>;
|
|
@@ -48,10 +48,10 @@ export declare const agentGrantSchema: z.ZodObject<{
|
|
|
48
48
|
agentId: z.ZodString;
|
|
49
49
|
sessionId: z.ZodString;
|
|
50
50
|
}, z.core.$strict>>;
|
|
51
|
-
}, z.core.$strict
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
52
|
meta: z.ZodOptional<z.ZodJSONSchema>;
|
|
53
53
|
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
54
|
-
}, z.core.$strict
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
55
|
/** A trusted host's bounded, addressed authority for fleet operations. */
|
|
56
56
|
export type AgentGrant = z.infer<typeof agentGrantSchema>;
|
|
57
57
|
/** A committed directory transition, returned in the host's transaction. */
|
|
@@ -74,17 +74,17 @@ export declare const agentIds: Readonly<{
|
|
|
74
74
|
/** An ordinary Agent directory identity. */
|
|
75
75
|
export type AgentId = CairnId<"agent", "agent">;
|
|
76
76
|
/** Stable replay input; configuration is an opaque host creation choice. */
|
|
77
|
-
export declare const agentCreationSchema: z.ZodObject<{
|
|
77
|
+
export declare const agentCreationSchema: z.ZodLazy<z.ZodObject<{
|
|
78
78
|
name: z.ZodString;
|
|
79
79
|
requestId: z.ZodString;
|
|
80
80
|
configuration: z.ZodString;
|
|
81
|
-
}, z.core.$strict
|
|
81
|
+
}, z.core.$strict>>;
|
|
82
82
|
/** One idempotent directory reservation. */
|
|
83
83
|
export type AgentCreation = z.infer<typeof agentCreationSchema>;
|
|
84
84
|
/** Owner-only rename input: an Agent's new display name. */
|
|
85
|
-
export declare const agentRenameSchema: z.ZodObject<{
|
|
85
|
+
export declare const agentRenameSchema: z.ZodLazy<z.ZodObject<{
|
|
86
86
|
name: z.ZodString;
|
|
87
|
-
}, z.core.$strict
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
88
|
/** Input to {@link createAgentDirectory}'s `rename`. */
|
|
89
89
|
export type AgentRename = z.infer<typeof agentRenameSchema>;
|
|
90
90
|
/** One durable Agent directory record. */
|
|
@@ -154,12 +154,12 @@ export declare function createAgentDirectory(sql: WatchdogSqliteOwner["sql"]): {
|
|
|
154
154
|
erasureRosterComplete: () => boolean;
|
|
155
155
|
};
|
|
156
156
|
/** Replay identity and work, with the parent supplied exclusively by the grant. */
|
|
157
|
-
export declare const agentDelegationTaskSchema: z.ZodObject<{
|
|
157
|
+
export declare const agentDelegationTaskSchema: z.ZodLazy<z.ZodObject<{
|
|
158
158
|
requestId: z.ZodString;
|
|
159
159
|
agentId: z.ZodString;
|
|
160
160
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
161
161
|
text: z.ZodString;
|
|
162
|
-
}, z.core.$strict
|
|
162
|
+
}, z.core.$strict>>;
|
|
163
163
|
/** A caller reuses this task unchanged while polling Pending. */
|
|
164
164
|
export type AgentDelegationTask = z.infer<typeof agentDelegationTaskSchema>;
|
|
165
165
|
/** Exact host facts encoded over internal transports, without transcript content. */
|
package/dist/fleet.js
CHANGED
|
@@ -18,7 +18,7 @@ export const agentActionSchema = z.enum([
|
|
|
18
18
|
"delegate",
|
|
19
19
|
]);
|
|
20
20
|
/** Attribution supplied by the admitting host, without Team semantics. */
|
|
21
|
-
export const agentProvenanceSchema = z.strictObject({
|
|
21
|
+
export const agentProvenanceSchema = z.lazy(() => z.strictObject({
|
|
22
22
|
actor: identity,
|
|
23
23
|
workflowRunId: identity.optional(),
|
|
24
24
|
/** Host fingerprint of the enclosing model program, frozen with replay input. */
|
|
@@ -29,9 +29,9 @@ export const agentProvenanceSchema = z.strictObject({
|
|
|
29
29
|
session: z
|
|
30
30
|
.strictObject({ agentId: identity, sessionId: identity })
|
|
31
31
|
.optional(),
|
|
32
|
-
});
|
|
32
|
+
}));
|
|
33
33
|
/** Fleet authority is supplied, never looked up in host policy. */
|
|
34
|
-
export const agentGrantSchema = z.strictObject({
|
|
34
|
+
export const agentGrantSchema = z.lazy(() => z.strictObject({
|
|
35
35
|
agents: z.union([z.literal("all"), z.array(identity)]),
|
|
36
36
|
actions: z.array(agentActionSchema).max(5),
|
|
37
37
|
expiresAt: z.number().int().nonnegative(),
|
|
@@ -39,7 +39,7 @@ export const agentGrantSchema = z.strictObject({
|
|
|
39
39
|
meta: z.json().optional(),
|
|
40
40
|
/** Delegation abuse bound; inherited paths may only narrow it. */
|
|
41
41
|
maxDepth: z.number().int().min(1).max(8).optional(),
|
|
42
|
-
});
|
|
42
|
+
}));
|
|
43
43
|
/** Refusal of supplied authority; no host policy lookup is performed. */
|
|
44
44
|
export class AgentGrantError extends Error {
|
|
45
45
|
reason;
|
|
@@ -67,30 +67,30 @@ export const agentIds = defineIdFamily({
|
|
|
67
67
|
version: 1,
|
|
68
68
|
kinds: { agent: { prefix: "agent" } },
|
|
69
69
|
});
|
|
70
|
-
const agentRowSchema = z.strictObject({
|
|
70
|
+
const agentRowSchema = z.lazy(() => z.strictObject({
|
|
71
71
|
agent_id: z.string(),
|
|
72
72
|
name: z.string(),
|
|
73
73
|
actor_user_id: z.string(),
|
|
74
74
|
created_at: z.number().int().nonnegative(),
|
|
75
75
|
updated_at: z.number().int().nonnegative(),
|
|
76
|
-
});
|
|
77
|
-
const receiptRowSchema = z.strictObject({
|
|
76
|
+
}));
|
|
77
|
+
const receiptRowSchema = z.lazy(() => z.strictObject({
|
|
78
78
|
request_id: z.string(),
|
|
79
79
|
actor_user_id: z.string(),
|
|
80
80
|
name: z.string(),
|
|
81
81
|
agent_id: z.string(),
|
|
82
82
|
computer_mode: z.string().min(1).max(4096),
|
|
83
|
-
});
|
|
83
|
+
}));
|
|
84
84
|
/** Stable replay input; configuration is an opaque host creation choice. */
|
|
85
|
-
export const agentCreationSchema = z.strictObject({
|
|
85
|
+
export const agentCreationSchema = z.lazy(() => z.strictObject({
|
|
86
86
|
name: z.string().min(1).max(256),
|
|
87
87
|
requestId: z.string().min(1).max(256),
|
|
88
88
|
configuration: z.string().min(1).max(4096),
|
|
89
|
-
});
|
|
89
|
+
}));
|
|
90
90
|
/** Owner-only rename input: an Agent's new display name. */
|
|
91
|
-
export const agentRenameSchema = z.strictObject({
|
|
91
|
+
export const agentRenameSchema = z.lazy(() => z.strictObject({
|
|
92
92
|
name: z.string().min(1).max(256),
|
|
93
|
-
});
|
|
93
|
+
}));
|
|
94
94
|
/** Directory input, replay or storage refusal. */
|
|
95
95
|
export class DirectoryError extends Error {
|
|
96
96
|
status;
|
|
@@ -247,7 +247,7 @@ export function createAgentDirectory(sql) {
|
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
/** Replay identity and work, with the parent supplied exclusively by the grant. */
|
|
250
|
-
export const agentDelegationTaskSchema = z.strictObject({
|
|
250
|
+
export const agentDelegationTaskSchema = z.lazy(() => z.strictObject({
|
|
251
251
|
requestId: identity,
|
|
252
252
|
agentId: identity,
|
|
253
253
|
sessionId: identity.optional(),
|
|
@@ -255,7 +255,7 @@ export const agentDelegationTaskSchema = z.strictObject({
|
|
|
255
255
|
.string()
|
|
256
256
|
.min(1)
|
|
257
257
|
.max(256 * 1024),
|
|
258
|
-
});
|
|
258
|
+
}));
|
|
259
259
|
/** Exact host facts encoded over internal transports, without transcript content. */
|
|
260
260
|
export const commandSettlementSchema = Schema.Struct({
|
|
261
261
|
terminal: SessionTerminalSchema,
|
|
@@ -318,11 +318,11 @@ export function delegationReplyMeta(delegation, replierName) {
|
|
|
318
318
|
const delegationMetadata = z.object({
|
|
319
319
|
delegation: FungiMessageMetaSchema.shape.delegation,
|
|
320
320
|
});
|
|
321
|
-
const delegationRowSchema = z.strictObject({
|
|
321
|
+
const delegationRowSchema = z.lazy(() => z.strictObject({
|
|
322
322
|
input: z.string(),
|
|
323
323
|
mail: z.string(),
|
|
324
324
|
receipt: z.string().nullable(),
|
|
325
|
-
});
|
|
325
|
+
}));
|
|
326
326
|
const decodeMail = Schema.decodeUnknownSync(Schema.fromJsonString(BirdDogMailSchema));
|
|
327
327
|
/**
|
|
328
328
|
* Hosted BirdDog submission and Pending observation. The durable row freezes
|
|
@@ -20,7 +20,7 @@ function decodeReply(request) {
|
|
|
20
20
|
mail.from.agentId !== reply.agentId ||
|
|
21
21
|
mail.from.sessionId !== reply.sessionId ||
|
|
22
22
|
request.command.type !== "prompt" ||
|
|
23
|
-
request.command.delivery !== "
|
|
23
|
+
request.command.delivery !== "steer")
|
|
24
24
|
throw new ShiitakeError("contract", "invalid", "Verified Agent reply does not match its mail");
|
|
25
25
|
return reply;
|
|
26
26
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* The retained preparation/result vocabulary is intentionally visible here;
|
|
4
4
|
* Shiitake supplies native Message values and its selected model stream.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import type { Api, Model, Usage } from "@earendil-works/pi-ai";
|
|
7
7
|
import type { MuleStreamFunction } from "@fungi.computer/mule/effect";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import type { BorrowedCompactionViewV0 } from "../../extensions.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { contentText, normalizeContext, retryAssistantCall, uuidv7, } from "@earendil-works/pi-ai";
|
|
1
|
+
// Leaf helpers, not Pi's root entry, which also evaluates its validators.
|
|
2
|
+
import { retryAssistantCall } from "@earendil-works/pi-ai/utils/retry";
|
|
3
|
+
import { contentText } from "@earendil-works/pi-ai/utils/text";
|
|
4
|
+
import { normalizeContext } from "@earendil-works/pi-ai/utils/transcript";
|
|
5
|
+
import { uuidv7 } from "@earendil-works/pi-ai/utils/uuid";
|
|
7
6
|
import * as Effect from "effect/Effect";
|
|
8
7
|
import { ShiitakeError } from "../../errors.js";
|
|
9
8
|
import { computeFileLists, createFileOps, extractFileOpsFromMessage, formatFileOperations, serializeConversation, SUMMARIZATION_PROMPT, SUMMARIZATION_SYSTEM_PROMPT, TURN_PREFIX_SUMMARIZATION_PROMPT, UPDATE_SUMMARIZATION_PROMPT, compactionSummaryMessage, estimateContextTokens, estimateTokens, summaryFailure, } from "./utils.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isContextOverflow, } from "@fungi.computer/mule/effect";
|
|
2
|
-
import { isRecoverableLength } from "@earendil-works/pi-ai";
|
|
2
|
+
import { isRecoverableLength } from "@earendil-works/pi-ai/utils/overflow";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import { ShiitakeError } from "../../errors.js";
|
|
5
5
|
import { borrowedView, compact, prepareCompaction, } from "./compaction.js";
|
|
@@ -355,7 +355,7 @@ export function openCoordinator(options, runtime) {
|
|
|
355
355
|
export function acceptAddressedMail(runtime, mail, meta, reply) {
|
|
356
356
|
return admitUserWork(runtime, mail.to.sessionId, {
|
|
357
357
|
requestId: mail.key,
|
|
358
|
-
delivery: "followUp",
|
|
358
|
+
delivery: reply === undefined ? "followUp" : "steer",
|
|
359
359
|
type: "prompt",
|
|
360
360
|
text: mail.content,
|
|
361
361
|
}, meta, mail, reply);
|
package/docs/api/effect.md
CHANGED
|
@@ -535,26 +535,6 @@ for it. An unreadable Session is its own `unavailable` row.
|
|
|
535
535
|
[`StoredSessionSummaryRow`](#storedsessionsummaryrow)[]; `next`: `string` \|
|
|
536
536
|
`undefined`; \}\>, [`ShiitakeError`](index.md#shiitakeerror), `never`\>
|
|
537
537
|
|
|
538
|
-
---
|
|
539
|
-
|
|
540
|
-
### inspectWoodstockStoreProtocol()
|
|
541
|
-
|
|
542
|
-
```ts
|
|
543
|
-
function inspectWoodstockStoreProtocol(owner): "fresh" | "v0" | "unmarked";
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
Inspect one unopened store before the file-backed host takes custody.
|
|
547
|
-
|
|
548
|
-
#### Parameters
|
|
549
|
-
|
|
550
|
-
| Parameter | Type |
|
|
551
|
-
| --------- | ------------------------------------- |
|
|
552
|
-
| `owner` | [`SqliteOwner`](index.md#sqliteowner) |
|
|
553
|
-
|
|
554
|
-
#### Returns
|
|
555
|
-
|
|
556
|
-
`"fresh"` \| `"v0"` \| `"unmarked"`
|
|
557
|
-
|
|
558
538
|
## References
|
|
559
539
|
|
|
560
540
|
### AbortCommand
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/shiitake",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Effect-native durable Session acceptance and bounded run orchestration",
|
|
6
6
|
"type": "module",
|
|
@@ -76,16 +76,16 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@fungi.computer/bird-dog": "0.0.1",
|
|
78
78
|
"@fungi.computer/cairn": "0.0.1",
|
|
79
|
-
"@fungi.computer/knapsack": "0.0
|
|
80
|
-
"@fungi.computer/mule": "0.0.
|
|
81
|
-
"@fungi.computer/mycelium": "0.0
|
|
79
|
+
"@fungi.computer/knapsack": "0.1.0",
|
|
80
|
+
"@fungi.computer/mule": "0.0.2",
|
|
81
|
+
"@fungi.computer/mycelium": "0.1.0",
|
|
82
82
|
"@fungi.computer/watchdog": "0.0.1",
|
|
83
83
|
"effect": "4.0.2",
|
|
84
84
|
"hono": "4.13.5",
|
|
85
85
|
"zod": "4.4.3",
|
|
86
86
|
"@earendil-works/pi-ai": "0.99.2",
|
|
87
|
-
"@fungi.computer/gills": "0.0
|
|
88
|
-
"@fungi.computer/agar": "0.0
|
|
87
|
+
"@fungi.computer/gills": "0.1.0",
|
|
88
|
+
"@fungi.computer/agar": "0.2.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@cloudflare/workers-types": "5.20260828.1",
|