@fungi.computer/shiitake-extensions 0.0.1 → 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/README.md +43 -13
- package/dist/almanac/contract.d.ts +94 -0
- package/dist/almanac/contract.js +71 -5
- package/dist/goal/client.d.ts +5 -2
- package/dist/goal/client.js +66 -72
- package/dist/goal/contract.d.ts +181 -64
- package/dist/goal/contract.js +102 -12
- package/dist/goal/host.js +188 -113
- package/dist/home/contract.d.ts +18 -0
- package/dist/home/contract.js +24 -3
- package/dist/home/host.d.ts +3 -0
- package/dist/home/host.js +1 -2
- package/dist/home/routing.js +13 -24
- package/dist/internal/history.d.ts +16 -0
- package/dist/internal/history.js +8 -0
- package/dist/loop/client.d.ts +1 -1
- package/dist/loop/client.js +28 -34
- package/dist/loop/contract.d.ts +113 -84
- package/dist/loop/contract.js +77 -9
- package/dist/loop/host.d.ts +1 -0
- package/dist/loop/host.js +17 -30
- package/dist/plan/client.d.ts +1 -1
- package/dist/plan/contract.d.ts +33 -0
- package/dist/plan/contract.js +28 -3
- package/dist/plan/host.js +12 -7
- package/dist/question/client.d.ts +1 -1
- package/dist/question/contract.d.ts +158 -0
- package/dist/question/contract.js +92 -7
- package/dist/question/host.js +34 -20
- package/dist/roster/conversation-agents.d.ts +31 -0
- package/dist/roster/conversation-agents.js +114 -0
- package/dist/roster.js +1 -0
- package/dist/skills/host.d.ts +1 -0
- package/dist/skills/host.js +22 -17
- package/dist/skills/source.d.ts +34 -0
- package/dist/subagents/client.d.ts +1 -1
- package/dist/subagents/client.js +43 -12
- package/dist/subagents/contract.d.ts +46 -8
- package/dist/subagents/contract.js +38 -8
- package/dist/subagents/host.d.ts +20 -8
- package/dist/subagents/host.js +58 -12
- package/docs/api/README.md +35 -0
- package/docs/api/almanac/contract.md +90 -0
- package/docs/api/almanac/host.md +19 -0
- package/docs/api/goal/client.md +26 -0
- package/docs/api/goal/contract.md +247 -0
- package/docs/api/goal/host.md +29 -0
- package/docs/api/home/contract.md +58 -0
- package/docs/api/home/host.md +55 -0
- package/docs/api/loop/client.md +25 -0
- package/docs/api/loop/contract.md +159 -0
- package/docs/api/loop/host.md +30 -0
- package/docs/api/plan/client.md +26 -0
- package/docs/api/plan/contract.md +163 -0
- package/docs/api/plan/host.md +19 -0
- package/docs/api/question/client.md +25 -0
- package/docs/api/question/contract.md +377 -0
- package/docs/api/question/host.md +19 -0
- package/docs/api/roster/conversation-agents.md +80 -0
- package/docs/api/roster.md +40 -0
- package/docs/api/skills/host.md +39 -0
- package/docs/api/skills/source.md +104 -0
- package/docs/api/subagents/client.md +26 -0
- package/docs/api/subagents/contract.md +131 -0
- package/docs/api/subagents/host.md +115 -0
- package/package.json +14 -8
package/dist/goal/contract.js
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
import { historySchema } from "../internal/history.js";
|
|
2
1
|
import { ExtensionId } from "@fungi.computer/shiitake/extensions";
|
|
3
2
|
import * as Schema from "effect/Schema";
|
|
4
3
|
import { CatalogStep } from "../internal/catalog.js";
|
|
5
4
|
/**
|
|
6
5
|
* Session goal: one durable objective per Session that Shiitake keeps
|
|
7
|
-
* working toward until the model reports it
|
|
8
|
-
*
|
|
6
|
+
* working toward until the model reports it achieved or a person clears it.
|
|
7
|
+
* Only a live or paused goal is current; a finished goal is history. Shared
|
|
8
|
+
* by the server extension and every client; its schemas are the one decoder.
|
|
9
9
|
*/
|
|
10
10
|
/** A goal objective: stored exactly as sent, never blank. */
|
|
11
11
|
export const Objective = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(4_000)), Schema.check(Schema.isPattern(/\S/u, { message: "Goal objective is blank" })));
|
|
12
|
+
/** Nonblank explanation recorded when a goal is achieved. */
|
|
12
13
|
export const GoalReason = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(1_000)), Schema.check(Schema.isPattern(/\S/u)));
|
|
13
14
|
const RequestId = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(256)));
|
|
14
|
-
|
|
15
|
+
const EpochMillis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
16
|
+
/** Why work paused, independent of the words shown to a person. */
|
|
17
|
+
export const GoalPauseCause = Schema.Struct({
|
|
18
|
+
/** Typed origin of the pause. */
|
|
19
|
+
kind: Schema.Literals([
|
|
20
|
+
"person",
|
|
21
|
+
"blocked",
|
|
22
|
+
"stalled",
|
|
23
|
+
"cancelled",
|
|
24
|
+
"failed",
|
|
25
|
+
"no-terminal",
|
|
26
|
+
]),
|
|
27
|
+
/** Additional explanation, or null when no detail was supplied. */
|
|
28
|
+
detail: Schema.NullOr(Schema.String),
|
|
29
|
+
});
|
|
30
|
+
/** The current goal every client sees; provisional terminals stay private. */
|
|
15
31
|
export const Goal = Schema.Struct({
|
|
16
32
|
/** Owner-issued revision that guards an explicit replacement. */
|
|
17
33
|
revision: Schema.String,
|
|
34
|
+
/** Objective being pursued by this Session. */
|
|
35
|
+
objective: Objective,
|
|
36
|
+
/** Live, or paused until a person resumes it (a blocked goal is paused). */
|
|
37
|
+
state: Schema.Literals(["active", "paused"]),
|
|
38
|
+
/** When this goal was set, in epoch milliseconds. */
|
|
39
|
+
startedAt: EpochMillis,
|
|
40
|
+
/** A typed cause while paused; null while active. */
|
|
41
|
+
pauseCause: Schema.NullOr(GoalPauseCause),
|
|
42
|
+
});
|
|
43
|
+
/** One finished goal: history only, never current. */
|
|
44
|
+
export const EndedGoal = Schema.Struct({
|
|
45
|
+
/** Per-Session order of endings, starting at 1. */
|
|
46
|
+
sequence: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
47
|
+
/** Objective that finished or was cleared. */
|
|
18
48
|
objective: Objective,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
49
|
+
/** Whether the model achieved the goal or a person cleared it. */
|
|
50
|
+
outcome: Schema.Literals(["achieved", "cleared"]),
|
|
51
|
+
/** The model's evidence for an achieved goal; null when cleared. */
|
|
52
|
+
reason: Schema.NullOr(GoalReason),
|
|
53
|
+
/** Completion time in epoch milliseconds. */
|
|
54
|
+
endedAt: EpochMillis,
|
|
55
|
+
/** Committed Session position when this goal ended; zero before any entry. */
|
|
56
|
+
afterSequence: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
22
57
|
});
|
|
58
|
+
/** How many finished goals a Session keeps for its chat lines. */
|
|
59
|
+
export const endedGoalLimit = 16;
|
|
23
60
|
/**
|
|
24
61
|
* Arguments of the human `/goal` command. A bare call opens the controls; each
|
|
25
62
|
* reply is a catalog step, so the conversation stays on the server.
|
|
26
63
|
*/
|
|
27
64
|
export const GoalCommandInput = Schema.Union([
|
|
28
65
|
Schema.Struct({
|
|
66
|
+
/** Select the explicit goal-setting action. */
|
|
29
67
|
action: Schema.Literal("set"),
|
|
68
|
+
/** New objective supplied by the person. */
|
|
30
69
|
objective: Objective,
|
|
70
|
+
/** Idempotency key for setting this objective. */
|
|
31
71
|
requestId: RequestId,
|
|
32
72
|
/** The revision the human confirmed replacing, when they confirmed one. */
|
|
33
73
|
expectedRevision: Schema.optional(Schema.NullOr(Schema.String)),
|
|
@@ -35,42 +75,92 @@ export const GoalCommandInput = Schema.Union([
|
|
|
35
75
|
confirmed: Schema.optional(Schema.Boolean),
|
|
36
76
|
}),
|
|
37
77
|
Schema.Struct({
|
|
78
|
+
/** Select an existing-goal control. */
|
|
38
79
|
action: Schema.Literals(["pause", "resume", "replace", "clear"]),
|
|
39
80
|
}),
|
|
40
81
|
Schema.Struct({}),
|
|
41
82
|
]);
|
|
42
83
|
/** Goal's contract: Session-scope human controls and one projection slot. */
|
|
43
84
|
export const GoalProjection = Schema.Struct({
|
|
85
|
+
/** The live or paused goal, or null when none is current. */
|
|
44
86
|
goal: Schema.NullOr(Goal),
|
|
45
|
-
|
|
87
|
+
/** The newest finished goals, oldest first. */
|
|
88
|
+
ended: Schema.Array(EndedGoal).check(Schema.isMaxLength(endedGoalLimit)),
|
|
89
|
+
/** Finished goals older than `ended` that this Session no longer keeps. */
|
|
90
|
+
omitted: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
46
91
|
});
|
|
92
|
+
/** Session-owned goal controls and their visible projection. */
|
|
47
93
|
export const goalContract = {
|
|
94
|
+
/** Stable extension identity. */
|
|
48
95
|
id: ExtensionId.make("botanical-session-goal"),
|
|
96
|
+
/** Goal commands admitted by the Session owner. */
|
|
49
97
|
commands: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
98
|
+
/** Open or answer the human goal controls. */
|
|
99
|
+
goal: {
|
|
100
|
+
/** The Session owns this goal. */
|
|
101
|
+
scope: "session",
|
|
102
|
+
/** Decode the control action. */
|
|
103
|
+
input: GoalCommandInput,
|
|
104
|
+
/** Return the server-owned conversation step. */
|
|
105
|
+
output: CatalogStep,
|
|
106
|
+
},
|
|
107
|
+
/** Pause work on the current goal. */
|
|
108
|
+
pause: {
|
|
109
|
+
/** The Session owns this goal. */
|
|
110
|
+
scope: "session",
|
|
111
|
+
/** No additional arguments are required. */
|
|
112
|
+
input: Schema.Struct({}),
|
|
113
|
+
/** Return the paused goal. */
|
|
114
|
+
output: Goal,
|
|
115
|
+
},
|
|
116
|
+
/** Resume work on a paused goal. */
|
|
117
|
+
resume: {
|
|
118
|
+
/** The Session owns this goal. */
|
|
119
|
+
scope: "session",
|
|
120
|
+
/** No additional arguments are required. */
|
|
121
|
+
input: Schema.Struct({}),
|
|
122
|
+
/** Return the active goal. */
|
|
123
|
+
output: Goal,
|
|
124
|
+
},
|
|
125
|
+
/** Clear the current objective. */
|
|
53
126
|
clear: {
|
|
127
|
+
/** The Session owns this goal. */
|
|
54
128
|
scope: "session",
|
|
129
|
+
/** No additional arguments are required. */
|
|
55
130
|
input: Schema.Struct({}),
|
|
131
|
+
/** A successful clear has no result fields. */
|
|
56
132
|
output: Schema.Struct({}),
|
|
57
133
|
},
|
|
134
|
+
/** Set an objective against the revision the person saw. */
|
|
58
135
|
set: {
|
|
136
|
+
/** The Session owns this goal. */
|
|
59
137
|
scope: "session",
|
|
138
|
+
/** Decode the new objective and replacement fence. */
|
|
60
139
|
input: Schema.Struct({
|
|
140
|
+
/** New objective to pursue. */
|
|
61
141
|
objective: Objective,
|
|
62
142
|
/** The revision the user saw, or null when they saw no goal. */
|
|
63
143
|
expectedRevision: Schema.NullOr(Schema.String),
|
|
144
|
+
/** Idempotency key for this setting command. */
|
|
64
145
|
requestId: RequestId,
|
|
65
146
|
}),
|
|
147
|
+
/** Return the goal and its admission receipt. */
|
|
66
148
|
output: Schema.Struct({
|
|
149
|
+
/** Newly current goal. */
|
|
67
150
|
goal: Goal,
|
|
151
|
+
/** Receipt for the accepted setting command. */
|
|
68
152
|
accepted: Schema.Struct({
|
|
153
|
+
/** Successful admission discriminator. */
|
|
69
154
|
status: Schema.Literal("accepted"),
|
|
155
|
+
/** Identity of the admitted command. */
|
|
70
156
|
commandId: Schema.String,
|
|
71
157
|
}),
|
|
72
158
|
}),
|
|
73
159
|
},
|
|
74
160
|
},
|
|
75
|
-
|
|
161
|
+
/** Current and ended goals visible to clients. */
|
|
162
|
+
projection: {
|
|
163
|
+
/** Decoder for the goal projection. */
|
|
164
|
+
schema: GoalProjection,
|
|
165
|
+
},
|
|
76
166
|
};
|