@fungi.computer/parakeet 0.12.0 → 0.12.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/dist/components/TimelineItem.js +4 -2
- package/dist/core/approval-decision.d.ts +7 -0
- package/dist/core/approval-decision.js +13 -3
- package/dist/core/build-timeline.js +7 -0
- package/dist/host-facts.d.ts +5 -2
- package/dist/host-facts.js +37 -43
- package/dist/store/types.d.ts +3 -0
- package/docs/api/headless.md +4 -0
- package/docs/api/index.md +1 -0
- package/package.json +8 -7
|
@@ -49,7 +49,7 @@ export const TimelineItem = memo(function TimelineItem({ item, onDismissFailed,
|
|
|
49
49
|
if (!assistantMessageVisible(item))
|
|
50
50
|
return null;
|
|
51
51
|
const modelFailure = item.isError
|
|
52
|
-
? plainModelFailure(item.text)
|
|
52
|
+
? plainModelFailure(item.modelFailure, item.text)
|
|
53
53
|
: undefined;
|
|
54
54
|
if (modelFailure !== undefined) {
|
|
55
55
|
// One line per run of identical failures, never the raw code.
|
|
@@ -71,7 +71,9 @@ export const TimelineItem = memo(function TimelineItem({ item, onDismissFailed,
|
|
|
71
71
|
retryLabel: "Choose model",
|
|
72
72
|
retryAriaLabel: "Choose model",
|
|
73
73
|
}
|
|
74
|
-
: onRetry === undefined ||
|
|
74
|
+
: onRetry === undefined ||
|
|
75
|
+
modelFailure.setup ||
|
|
76
|
+
modelFailure.usageLimit
|
|
75
77
|
? {}
|
|
76
78
|
: { onRetry, retryAriaLabel: "Retry prompt" }) }), _jsx("div", { className: "px-3 text-xs text-dim", ...(item.providerError === undefined
|
|
77
79
|
? {}
|
|
@@ -26,6 +26,13 @@ export type ApprovalFacts = Readonly<{
|
|
|
26
26
|
access: string;
|
|
27
27
|
/** What the tool would be given, as the ledger describes it. */
|
|
28
28
|
description: Readonly<{
|
|
29
|
+
/** Display words supplied by the admitted App catalog, never derived from IDs. */
|
|
30
|
+
app?: Readonly<{
|
|
31
|
+
/** The App's published display name. */
|
|
32
|
+
displayName: string;
|
|
33
|
+
/** The operation's published human description. */
|
|
34
|
+
operationLabel: string;
|
|
35
|
+
}>;
|
|
29
36
|
/** Size of the input in bytes. */
|
|
30
37
|
inputBytes: number;
|
|
31
38
|
/** Digest of the input. */
|
|
@@ -36,11 +36,21 @@ function undoDetail(view) {
|
|
|
36
36
|
: "Can be undone",
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
+
function appApprovalTitle(app) {
|
|
40
|
+
// A short catalog action can be embedded in a question. Prose stays a label;
|
|
41
|
+
// never attempt to turn a module/operation identifier into display words.
|
|
42
|
+
const action = app.operationLabel.trim().replace(/\.$/, "");
|
|
43
|
+
if (action.length === 0 || /[.!?\n]/.test(action))
|
|
44
|
+
return `Allow ${app.displayName} · ${app.operationLabel}?`;
|
|
45
|
+
return `Allow ${app.displayName} to ${action.charAt(0).toLowerCase()}${action.slice(1)}?`;
|
|
46
|
+
}
|
|
39
47
|
function connectedToolCard(view, now) {
|
|
40
48
|
const { record } = view;
|
|
41
49
|
return {
|
|
42
50
|
content: {
|
|
43
|
-
title:
|
|
51
|
+
title: record.description.app === undefined
|
|
52
|
+
? `Allow ${record.module} · ${record.operation}?`
|
|
53
|
+
: appApprovalTitle(record.description.app),
|
|
44
54
|
summary: `${record.requester.displayName} wants to use a connected tool.`,
|
|
45
55
|
facts: [
|
|
46
56
|
{
|
|
@@ -210,7 +220,7 @@ export async function askApproval(interaction, input) {
|
|
|
210
220
|
type: "decision",
|
|
211
221
|
message: card.content.title,
|
|
212
222
|
summary: familyOn
|
|
213
|
-
?
|
|
223
|
+
? `Automatic approval is on for ${record.description.app?.displayName ?? "this tool"}.`
|
|
214
224
|
: card.content.summary,
|
|
215
225
|
facts: card.content.facts?.map((fact) => ({ ...fact })),
|
|
216
226
|
body: card.content.body,
|
|
@@ -263,7 +273,7 @@ export async function askApproval(interaction, input) {
|
|
|
263
273
|
const confirmed = await interaction.prompt({
|
|
264
274
|
type: "decision",
|
|
265
275
|
message: `${source.family.label}?`,
|
|
266
|
-
summary: `
|
|
276
|
+
summary: `All ${record.description.app?.displayName ?? "this tool"} requests that ${record.access === "write" ? "change data in Fungi" : "reach outside Fungi"} will run without asking, not just this action.`,
|
|
267
277
|
options: [
|
|
268
278
|
{ value: "back", label: "Back" },
|
|
269
279
|
{ value: "family", label: source.family.label },
|
|
@@ -95,6 +95,8 @@ function assistantMessageItem(id, value, blocks) {
|
|
|
95
95
|
? "The run was cancelled."
|
|
96
96
|
: ""
|
|
97
97
|
: blocks.text.join(""),
|
|
98
|
+
...(value.stopReason === "error" &&
|
|
99
|
+
value.modelFailure !== undefined && { modelFailure: value.modelFailure }),
|
|
98
100
|
usage: {
|
|
99
101
|
cost: value.usage.cost.total,
|
|
100
102
|
tokens: value.usage.totalTokens,
|
|
@@ -133,6 +135,8 @@ function collapseProviderErrors(rows, breakBefore) {
|
|
|
133
135
|
// Error-only turns repeat too: a provider detail is not required to fold.
|
|
134
136
|
(row.providerError === undefined) ===
|
|
135
137
|
(prior.providerError === undefined) &&
|
|
138
|
+
row.modelFailure?.provider === prior.modelFailure?.provider &&
|
|
139
|
+
row.modelFailure?.cause.code === prior.modelFailure?.cause.code &&
|
|
136
140
|
row.text === prior.text &&
|
|
137
141
|
row.errorDetail === prior.errorDetail &&
|
|
138
142
|
row.thinking === prior.thinking &&
|
|
@@ -145,6 +149,9 @@ function collapseProviderErrors(rows, breakBefore) {
|
|
|
145
149
|
...(row.providerError !== undefined && {
|
|
146
150
|
providerError: row.providerError,
|
|
147
151
|
}),
|
|
152
|
+
...(row.modelFailure !== undefined && {
|
|
153
|
+
modelFailure: row.modelFailure,
|
|
154
|
+
}),
|
|
148
155
|
};
|
|
149
156
|
aliases.set(row.id, prior.id);
|
|
150
157
|
}
|
package/dist/host-facts.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ModelFailure } from "@fungi.computer/mule";
|
|
1
2
|
/** Whether a model is connected, with the one fix the host offers. */
|
|
2
3
|
export type ParakeetModelSetup = Readonly<{
|
|
3
4
|
/** `missing` turns a model failure into the setup notice; `unknown` leaves it a failure. */
|
|
@@ -35,8 +36,10 @@ export type PlainModelFailure = Readonly<{
|
|
|
35
36
|
setup: boolean;
|
|
36
37
|
/** The saved choice cannot run Agent tools; changing models is the fix. */
|
|
37
38
|
toolsUnsupported: boolean;
|
|
39
|
+
/** Exhausted usage or account quota cannot be fixed by retrying this request. */
|
|
40
|
+
usageLimit: boolean;
|
|
38
41
|
message: string;
|
|
39
42
|
detail: string;
|
|
40
43
|
}>;
|
|
41
|
-
/**
|
|
42
|
-
export declare function plainModelFailure(text: string): PlainModelFailure | undefined;
|
|
44
|
+
/** Describe typed failure facts; display text alone never supplies a cause or provider. */
|
|
45
|
+
export declare function plainModelFailure(failure: ModelFailure | undefined, text: string): PlainModelFailure | undefined;
|
package/dist/host-facts.js
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
+
import { providerDisplayNames } from "@fungi.computer/mule";
|
|
2
3
|
/** Provided by the conversation view; read by the failure and empty states. */
|
|
3
4
|
export const ParakeetHostFactsContext = createContext({});
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const failureMessages = new Map([
|
|
6
|
+
["setup_required", "No model is connected"],
|
|
7
|
+
[
|
|
8
|
+
"tools_unsupported",
|
|
9
|
+
"This model can’t use tools here. Pick one marked tools.",
|
|
10
|
+
],
|
|
11
|
+
["provider_unavailable", "Couldn’t reach the model"],
|
|
12
|
+
["rate-limit", "The model provider is receiving too many requests"],
|
|
13
|
+
["overloaded", "The model provider is overloaded"],
|
|
14
|
+
["provider_rejected", "The model provider refused the request"],
|
|
15
|
+
["request_failed", "The model request failed"],
|
|
16
|
+
]);
|
|
17
|
+
/** Describe typed failure facts; display text alone never supplies a cause or provider. */
|
|
18
|
+
export function plainModelFailure(failure, text) {
|
|
19
|
+
if (failure === undefined)
|
|
18
20
|
return undefined;
|
|
19
|
-
|
|
21
|
+
const base = {
|
|
22
|
+
unreachable: false,
|
|
23
|
+
setup: false,
|
|
24
|
+
toolsUnsupported: false,
|
|
25
|
+
usageLimit: false,
|
|
26
|
+
detail: text,
|
|
27
|
+
};
|
|
28
|
+
const code = failure.cause.code;
|
|
29
|
+
if (code === "usage-limit-reached") {
|
|
30
|
+
const name = providerDisplayNames.get(failure.provider) ?? failure.provider;
|
|
20
31
|
return {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
message: "No model is connected",
|
|
25
|
-
detail: text,
|
|
26
|
-
};
|
|
27
|
-
if (code === "tools_unsupported")
|
|
28
|
-
return {
|
|
29
|
-
unreachable: false,
|
|
30
|
-
setup: false,
|
|
31
|
-
toolsUnsupported: true,
|
|
32
|
-
message: "This model can’t use tools here. Pick one marked tools.",
|
|
33
|
-
detail: text,
|
|
34
|
-
};
|
|
35
|
-
return code === "provider_unavailable"
|
|
36
|
-
? {
|
|
37
|
-
unreachable: true,
|
|
38
|
-
setup: false,
|
|
39
|
-
toolsUnsupported: false,
|
|
40
|
-
message: "Couldn’t reach the model",
|
|
41
|
-
detail: text,
|
|
42
|
-
}
|
|
43
|
-
: {
|
|
44
|
-
unreachable: false,
|
|
45
|
-
setup: false,
|
|
46
|
-
toolsUnsupported: false,
|
|
47
|
-
message: "The model request failed",
|
|
48
|
-
detail: text,
|
|
32
|
+
...base,
|
|
33
|
+
usageLimit: true,
|
|
34
|
+
message: `${name} usage limit reached.`,
|
|
49
35
|
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...base,
|
|
39
|
+
unreachable: code === "provider_unavailable",
|
|
40
|
+
setup: code === "setup_required",
|
|
41
|
+
toolsUnsupported: code === "tools_unsupported",
|
|
42
|
+
message: failureMessages.get(code) ?? "The model request failed",
|
|
43
|
+
};
|
|
50
44
|
}
|
package/dist/store/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParakeetAuthor } from "../core/author-labels.js";
|
|
2
|
+
import type { ModelFailure } from "@fungi.computer/mule";
|
|
2
3
|
import type { PromptDelivery, PromptCommand, SessionCompactionTrigger, SessionMessage } from "@fungi.computer/shiitake/client";
|
|
3
4
|
import type { ToolArguments } from "../core/tool-contract.js";
|
|
4
5
|
import type { ToolCallView } from "../core/tool-view.js";
|
|
@@ -73,6 +74,8 @@ export type AssistantMessageItem = Readonly<{
|
|
|
73
74
|
text: string;
|
|
74
75
|
/** Pi's private failed-turn error text; never a terminal or delegation diagnostic. */
|
|
75
76
|
providerError?: string;
|
|
77
|
+
/** Provider identity and typed failure cause from the stored assistant turn. */
|
|
78
|
+
modelFailure?: ModelFailure;
|
|
76
79
|
/** Short assistant output retained before a provider failure, not provider prose. */
|
|
77
80
|
errorDetail?: string;
|
|
78
81
|
/** Consecutive failures with the same visible headline and detail. */
|
package/docs/api/headless.md
CHANGED
package/docs/api/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/parakeet",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Standalone React composer for a typed Shiitake Session",
|
|
@@ -63,14 +63,15 @@
|
|
|
63
63
|
"react-dom": "^18.2.0 || ^19.2.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@earendil-works/pi-ai": "1.
|
|
67
|
-
"@fungi.computer/agar": "0.18.
|
|
68
|
-
"@fungi.computer/bird-dog": "0.3.
|
|
66
|
+
"@earendil-works/pi-ai": "1.5.2",
|
|
67
|
+
"@fungi.computer/agar": "0.18.2",
|
|
68
|
+
"@fungi.computer/bird-dog": "0.3.7",
|
|
69
69
|
"@fungi.computer/cairn": "0.1.0",
|
|
70
|
-
"@fungi.computer/caps": "0.
|
|
70
|
+
"@fungi.computer/caps": "0.12.0",
|
|
71
71
|
"@fungi.computer/gills": "0.3.0",
|
|
72
|
-
"@fungi.computer/knapsack": "0.4.
|
|
73
|
-
"@fungi.computer/
|
|
72
|
+
"@fungi.computer/knapsack": "0.4.14",
|
|
73
|
+
"@fungi.computer/mule": "0.2.4",
|
|
74
|
+
"@fungi.computer/shiitake": "0.19.0",
|
|
74
75
|
"@fungi.computer/sigils": "0.3.2",
|
|
75
76
|
"@fungi.computer/sprite": "0.2.2",
|
|
76
77
|
"@fungi.computer/sprite-zdog": "0.3.2",
|