fuli-context 0.25.0 → 0.25.1
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/web/assets/{CopyFixPrompt-CErC3Paj.js → CopyFixPrompt-DlarhfPK.js} +1 -1
- package/dist/web/assets/{OverviewPage-DFW3Ua0Z.js → OverviewPage-BkJ17OYv.js} +1 -1
- package/dist/web/assets/{SettingsPage-BVIU7iFS.js → SettingsPage-CWGk0XZ_.js} +1 -1
- package/dist/web/assets/{index-C7IVLf_v.js → index-RWEx1M91.js} +3 -3
- package/dist/web/assets/{version-1lwoVj6f.js → version-Ci3l8Vnb.js} +1 -1
- package/dist/web/index.html +3 -3
- package/docs/agent-roundtable.md +2 -1
- package/graph-provider/pyproject.toml +1 -1
- package/native/win32/fuli-win-helper.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/roundtable/src/roundtable/delivery-state.js +1 -1
- package/packages/roundtable/src/roundtable/service.js +2 -0
- package/packages/roundtable/src/roundtable/store.js +23 -3
- package/skills/capturing-session-knowledge/SKILL.md +4 -4
- package/skills/operating-fuli/SKILL.md +1 -1
- package/src/agent-tools/graph-handlers.js +5 -3
- package/src/agents/call-source.js +11 -0
- package/src/agents/claude-desktop/code-tab-token-source.js +26 -0
- package/src/agents/lifecycle-failure.js +6 -5
- package/src/conversations/current-task-lookup.js +2 -3
- package/src/graphiti/checkpoint-provider-outage.js +23 -0
- package/src/graphiti/provider-outage.js +20 -0
- package/src/graphiti/task-context-entry.js +9 -1
- package/src/graphiti/task-entry-preferences.js +1 -1
- package/src/graphiti/task-entry-provider-outage.js +25 -0
- package/src/graphiti/task-knowledge-checkpoint.js +1 -1
- package/src/graphiti/task-scene.js +1 -1
- package/src/mcp/create-mcp-server.js +7 -4
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/whats-new/lines/0.25.1.json +13 -0
|
Binary file
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fuli-context",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "fuli-context",
|
|
9
|
-
"version": "0.25.
|
|
9
|
+
"version": "0.25.1",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@agentclientprotocol/sdk": "1.5.0",
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ const INBOX = 'sees it in its inbox when its next task starts (task-entry agent_
|
|
|
12
12
|
const NOT_STARTED = {
|
|
13
13
|
execution_claimed: ({ name, blockedBy }) => `FULI started no session: an earlier message to ${name}`
|
|
14
14
|
+ (blockedBy?.messageId ? ` (${blockedBy.messageId}${blockedBy.since ? `, since ${blockedBy.since}` : ''})` : '')
|
|
15
|
-
+ ' still owns its one wake, and FULI never runs two at once.',
|
|
15
|
+
+ ' still owns its one wake, and FULI never runs two at once. A wake that nothing ends stops holding an hour after it began; send again then.',
|
|
16
16
|
cleanup_unconfirmed: ({ name }) => `FULI started no session: ${name}'s previously woken process has not been confirmed to end.`,
|
|
17
17
|
chat_waiting: ({ name }) => `FULI started no session: ${name} is already waiting in this chat.`,
|
|
18
18
|
no_client: ({ name, clients }) => clients.length
|
|
@@ -538,6 +538,8 @@ export function createAgentRoundtable({ host, peer = null, openStore, wake = wak
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
async function cancelAsk(ask) {
|
|
541
|
+
// A wake that outlived its console no longer answers it; its ask is back in the inbox.
|
|
542
|
+
if (ask.status === 'delivering' && !peer?.hasSent(ask.id) && store.expireStaleClaims(spaceId(), ask.to_agent)) ask = store.getMessage(ask.id);
|
|
541
543
|
if (peer?.hasSent(ask.id)) {
|
|
542
544
|
if (!REMOTE_PENDING.has(ask.status)) return remoteView(ask);
|
|
543
545
|
return remoteView(applyRemote(ask.id, await peer.cancel(ask.id)));
|
|
@@ -54,12 +54,18 @@ export const ROUNDTABLE_FORMAT = sqliteFormat({
|
|
|
54
54
|
pragmas: 'PRAGMA journal_mode = WAL;'
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
// The longest wake waits 15 minutes for its answer. A claim still active an hour
|
|
58
|
+
// later has no wake behind it: the console restarted or crashed mid-wake. It
|
|
59
|
+
// stops blocking the Agent; a run whose exit is unconfirmed stays held.
|
|
60
|
+
export const WAKE_CLAIM_TTL_MS = 60 * 60 * 1000;
|
|
61
|
+
|
|
57
62
|
// Every Agent-to-Agent exchange is kept as a thread of messages so people can
|
|
58
63
|
// see who talked to whom, through which client, and what was said. The file
|
|
59
64
|
// is shared by the console and every client's MCP process.
|
|
60
|
-
export function createRoundtableStore(path = ':memory:') {
|
|
65
|
+
export function createRoundtableStore(path = ':memory:', { clock = () => new Date() } = {}) {
|
|
61
66
|
const database = openFormattedDatabase(path, ROUNDTABLE_FORMAT);
|
|
62
|
-
const now = () =>
|
|
67
|
+
const now = () => clock().toISOString();
|
|
68
|
+
const claimCutoff = () => new Date(clock().getTime() - WAKE_CLAIM_TTL_MS).toISOString();
|
|
63
69
|
const chat = createChatStore(database, path);
|
|
64
70
|
const attention = createAttentionInboxStore(database, chat);
|
|
65
71
|
const discussions = createGroupDiscussionStore(database, chat);
|
|
@@ -156,6 +162,7 @@ export function createRoundtableStore(path = ':memory:') {
|
|
|
156
162
|
claimExecution(spaceId, agentId, askId, { chatWakeChatId = null } = {}) {
|
|
157
163
|
return transaction(() => {
|
|
158
164
|
if (chatWakeChatId && chat.waiting(spaceId, `local:${agentId}`, chatWakeChatId)) return { claimed: false, reason: 'chat_waiting' };
|
|
165
|
+
this.expireStaleClaims(spaceId, agentId);
|
|
159
166
|
const state = this.executionState(spaceId, agentId, askId);
|
|
160
167
|
if (state.held) return { claimed: false, reason: 'cleanup_unconfirmed' };
|
|
161
168
|
if (state.busy) return { claimed: false, reason: 'execution_claimed', blockedBy: state.claim };
|
|
@@ -171,11 +178,24 @@ export function createRoundtableStore(path = ':memory:') {
|
|
|
171
178
|
(m.execution_claim='active' OR (m.cleanup_status='unconfirmed' AND m.cleanup_released_at IS NULL))
|
|
172
179
|
ORDER BY m.execution_claimed_at`)
|
|
173
180
|
.all(spaceId, agentId, exceptAskId);
|
|
174
|
-
const
|
|
181
|
+
const cutoff = claimCutoff();
|
|
182
|
+
const active = blocking.find(row => row.execution_claim === 'active' && row.execution_claimed_at >= cutoff);
|
|
175
183
|
// The earlier ask that holds the Agent, so a refused sender can name what it waits on.
|
|
176
184
|
return { busy: Boolean(active), claim: active ? { messageId: active.id, since: active.execution_claimed_at } : null,
|
|
177
185
|
held: blocking.some(row => row.cleanup_status === 'unconfirmed' && row.cleanup_released_at === null) };
|
|
178
186
|
},
|
|
187
|
+
// A stale claim's ask goes back to the inbox, so it can be read or cancelled.
|
|
188
|
+
expireStaleClaims(spaceId, agentId) {
|
|
189
|
+
const expired = database.prepare(`UPDATE messages SET execution_claim = 'expired',
|
|
190
|
+
status = CASE WHEN status = 'delivering' THEN 'queued' ELSE status END,
|
|
191
|
+
error = CASE WHEN status = 'delivering' THEN 'wake_expired' ELSE error END, updated_at = ?
|
|
192
|
+
WHERE to_agent = ? AND kind = 'ask' AND execution_claim = 'active' AND execution_claimed_at < ?
|
|
193
|
+
AND (cleanup_status IS NULL OR cleanup_status != 'unconfirmed')
|
|
194
|
+
AND thread_id IN (SELECT id FROM threads WHERE space_id = ?)`)
|
|
195
|
+
.run(now(), agentId, claimCutoff(), spaceId).changes;
|
|
196
|
+
if (expired) chat.publishChanges();
|
|
197
|
+
return expired;
|
|
198
|
+
},
|
|
179
199
|
// Only after the owned process was observed to end, or never started. An
|
|
180
200
|
// unconfirmed cleanup leaves the claim active until a proof releases it.
|
|
181
201
|
finishExecution(askId) {
|
|
@@ -27,9 +27,9 @@ directory. It also uses the submitted prompt transiently for bounded automatic p
|
|
|
27
27
|
recall and never returns that prompt; it keeps it on this computer only so `run_delegated_action`
|
|
28
28
|
can check words relayed as the person's decision in the same turn, until the task checkpoints. Apply the returned `task_knowledge_recall` and
|
|
29
29
|
preferences, then retain the opaque task token for any required checkpoint;
|
|
30
|
-
do not redundantly call `get_collaboration_preferences`.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
do not redundantly call `get_collaboration_preferences`. Claude Desktop's FULI connection
|
|
31
|
+
(`claude`) accepts its Code tab's `claude_code` hook tokens. If a FULI call refuses that token as
|
|
32
|
+
begun in another client, call `get_collaboration_preferences` through that connection once and pass
|
|
33
33
|
its token to every call made through it, checkpoint included; never retry the refused token.
|
|
34
34
|
|
|
35
35
|
After a FULI update an open session can still have a FULI MCP connection on the older version.
|
|
@@ -66,7 +66,7 @@ remains unverified even if the preference fallback and task-summary checkpoint s
|
|
|
66
66
|
|
|
67
67
|
## Mandatory reply identity
|
|
68
68
|
|
|
69
|
-
Every final user-visible reply MUST include the current task’s `agent_receipt.markdown` unchanged exactly once. This includes greetings, status-only replies, failures, `retain_nothing`, and capture-disabled tasks. The receipt is independent of whether a memory checkpoint was saved. Never substitute a client name, configured peer, or an earlier task’s owner. If a legacy/unavailable entry supplies no receipt, explicitly state that the FULI Agent identity is unavailable. A receipt with no authorized owner already supplies the correct neutral text.
|
|
69
|
+
Every final user-visible reply MUST include the current task’s `agent_receipt.markdown` unchanged exactly once. This includes greetings, status-only replies, failures, `retain_nothing`, and capture-disabled tasks. The receipt is independent of whether a memory checkpoint was saved. Never substitute a client name, configured peer, or an earlier task’s owner. If a legacy/unavailable entry supplies no receipt, explicitly state that the FULI Agent identity is unavailable. When `get_collaboration_preferences` returns `status: preferences_unavailable` (FULI's graph service did not answer), follow its `guidance`: continue without FULI preferences, retry it once before any FULI write or the final reply, and never reuse an earlier token. When `checkpoint_task_knowledge` returns `status: checkpoint_incomplete`, retry it once with exactly the same arguments (FULI may already keep the first input; changed wording is refused) and do not claim the task was saved until it returns `checkpointed`. A receipt with no authorized owner already supplies the correct neutral text.
|
|
70
70
|
|
|
71
71
|
Apply only `effective_preferences`. Personal-global preferences apply in every user task;
|
|
72
72
|
project-scoped preferences layer on only for the exact selected project. Do not apply items
|
|
@@ -104,7 +104,7 @@ Read each returned worker's `context.agent.profile.allowedClients` and `executor
|
|
|
104
104
|
|
|
105
105
|
## Mandatory reply identity
|
|
106
106
|
|
|
107
|
-
Every final user-visible reply MUST include the current task’s `agent_receipt.markdown` unchanged exactly once. This includes greetings, status-only replies, failures, `retain_nothing`, and capture-disabled tasks. The receipt is independent of whether a memory checkpoint was saved. Never substitute a client name, configured peer, or an earlier task’s owner. If a legacy/unavailable entry supplies no receipt, explicitly state that the FULI Agent identity is unavailable. A receipt with no authorized owner already supplies the correct neutral text.
|
|
107
|
+
Every final user-visible reply MUST include the current task’s `agent_receipt.markdown` unchanged exactly once. This includes greetings, status-only replies, failures, `retain_nothing`, and capture-disabled tasks. The receipt is independent of whether a memory checkpoint was saved. Never substitute a client name, configured peer, or an earlier task’s owner. If a legacy/unavailable entry supplies no receipt, explicitly state that the FULI Agent identity is unavailable. When `get_collaboration_preferences` returns `status: preferences_unavailable` (FULI's graph service did not answer), follow its `guidance`: continue without FULI preferences, retry it once before any FULI write or the final reply, and never reuse an earlier token. When `checkpoint_task_knowledge` returns `status: checkpoint_incomplete`, retry it once with exactly the same arguments (FULI may already keep the first input; changed wording is refused) and do not claim the task was saved until it returns `checkpointed`. A receipt with no authorized owner already supplies the correct neutral text.
|
|
108
108
|
|
|
109
109
|
A `FULI 迁移已确认:…` line in the entry receipt means the person already confirmed, in the console, moving this session's temporary-project items: it says how many moved and how many still wait there. Do not ask them to confirm it again; continue the work. The line is information only and grants nothing. A `FULI 待迁移` line is the opposite: the move still waits on the linked page.
|
|
110
110
|
|
|
@@ -16,6 +16,8 @@ import { OLD_DATA_HANDLERS } from '../old-data/agent-tools.js';
|
|
|
16
16
|
import { REPLY_ECHO_HANDLERS } from '../graphiti/reply-echo-agent-tool.js';
|
|
17
17
|
import { OCCUPATION_KIT_HANDLERS } from '../occupation-plugins/agent-tools.js';
|
|
18
18
|
import { agentNamingStyleAnswer } from '../agent-naming/naming-style.js';
|
|
19
|
+
import { withProviderOutageEntry } from '../graphiti/task-entry-provider-outage.js';
|
|
20
|
+
import { withCheckpointOutageStatus } from '../graphiti/checkpoint-provider-outage.js';
|
|
19
21
|
|
|
20
22
|
// These tools read or change the two local stores that can retain deleted
|
|
21
23
|
// knowledge. Provider-only reads and unrelated tools remain available.
|
|
@@ -117,13 +119,13 @@ const HANDLERS = Object.freeze({
|
|
|
117
119
|
begin_task_context: (app, input) => app.beginTaskContext(input),
|
|
118
120
|
read_task_preferences: (app, input) => app.readTaskPreferences(input),
|
|
119
121
|
checkpoint_task_knowledge: (app, input) =>
|
|
120
|
-
app.checkpointTaskKnowledge(input),
|
|
122
|
+
withCheckpointOutageStatus(app.checkpointTaskKnowledge(input)),
|
|
121
123
|
verify_task_checkpoint: (app, input) => app.verifyTaskCheckpoint(input),
|
|
122
|
-
get_collaboration_preferences: (app, input) => app.getCollaborationPreferences({
|
|
124
|
+
get_collaboration_preferences: (app, input) => withProviderOutageEntry(app.getCollaborationPreferences({
|
|
123
125
|
...input,
|
|
124
126
|
agentInvocation: true,
|
|
125
127
|
agentToolName: 'get_collaboration_preferences'
|
|
126
|
-
}),
|
|
128
|
+
})),
|
|
127
129
|
get_user_taste_skill: (app, input) => app.getUserTasteSkill(input),
|
|
128
130
|
resolve_deferred_preference_conflict: (app, input) =>
|
|
129
131
|
app.resolveDeferredPreferenceConflict({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DESKTOP_SOURCE, desktopCallSource } from './claude-desktop/code-tab-token-source.js';
|
|
2
|
+
|
|
3
|
+
// The client one MCP call runs as. A connection runs as the client it was
|
|
4
|
+
// started for, except where that client's process also serves another
|
|
5
|
+
// client's sessions: Claude Desktop's serves its Code tab (rec#107).
|
|
6
|
+
const RESOLVERS = Object.freeze({ [DESKTOP_SOURCE]: desktopCallSource });
|
|
7
|
+
|
|
8
|
+
export async function callSourceApplication(app, sourceApplication, input) {
|
|
9
|
+
const resolve = RESOLVERS[sourceApplication];
|
|
10
|
+
return resolve ? resolve(app, input) : sourceApplication;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProviderRequestError } from '../../graphiti/provider-client.js';
|
|
2
|
+
|
|
3
|
+
// rec#107. Claude Desktop runs FULI from its own configuration as one MCP
|
|
4
|
+
// process (`--source-application claude`), and that process can also serve a
|
|
5
|
+
// session in its Code tab, whose prompt hook is Claude Code's and begins the
|
|
6
|
+
// task as `claude_code`. Every call carrying that hook's token was refused as
|
|
7
|
+
// another client's, and the connection could begin no task of its own (it
|
|
8
|
+
// proves no native session), so the Agent could neither checkpoint nor answer
|
|
9
|
+
// on the roundtable. A call through this connection that carries a token the
|
|
10
|
+
// Provider holds for `claude_code` runs as `claude_code`; any other call, and
|
|
11
|
+
// every token of another client, keeps `claude`.
|
|
12
|
+
export const DESKTOP_SOURCE = 'claude';
|
|
13
|
+
const CODE_TAB_SOURCE = 'claude_code';
|
|
14
|
+
|
|
15
|
+
export async function desktopCallSource(app, input) {
|
|
16
|
+
const token = input?.taskContextToken;
|
|
17
|
+
if (typeof token !== 'string' || !token || typeof app?.taskContextRegistry?.context !== 'function') return DESKTOP_SOURCE;
|
|
18
|
+
try {
|
|
19
|
+
await app.taskContextRegistry.context(token, CODE_TAB_SOURCE);
|
|
20
|
+
return CODE_TAB_SOURCE;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
// 404: not a Code-tab token (this client's own, superseded or unknown); the call decides as itself.
|
|
23
|
+
if (error instanceof ProviderRequestError && error.status === 404) return DESKTOP_SOURCE;
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
2
|
|
|
3
3
|
import { diagnosticEventLog } from '../diagnostics/event-log.js';
|
|
4
|
-
import { errorCode } from '../diagnostics/safe-event.js';
|
|
4
|
+
import { errorCode, failureReason } from '../diagnostics/safe-event.js';
|
|
5
5
|
import { resolveGraphRuntimeOptions } from '../graphiti/runtime-config.js';
|
|
6
6
|
import { hookFailureCause } from './lifecycle-message.js';
|
|
7
7
|
import { consoleAutostartNotice } from '../local-runtime/console-autostart-record.js';
|
|
8
8
|
|
|
9
9
|
// A lifecycle hook that failed records it in the data directory's diagnostics
|
|
10
|
-
// log (rec#73), with
|
|
11
|
-
//
|
|
12
|
-
//
|
|
10
|
+
// log (rec#73), with its cause and the session as correlation. Common to
|
|
11
|
+
// every Agent's hook; each passes its own client and event. Never throws:
|
|
12
|
+
// the hook's answer is already decided.
|
|
13
13
|
export function recordHookFailure({ runtimeConfigPath, client, event, error, sessionId = null, startedAt = null,
|
|
14
14
|
now = Date.now }) {
|
|
15
15
|
if (typeof runtimeConfigPath !== 'string' || !runtimeConfigPath) return false;
|
|
16
16
|
return diagnosticEventLog(dirname(runtimeConfigPath)).record({
|
|
17
17
|
component: 'hook', operation: `${client}.${event ?? 'unknown'}`, outcome: 'failed',
|
|
18
|
-
|
|
18
|
+
// A controlled error's message names the refused field or rule without its value (rec#85).
|
|
19
|
+
code: errorCode(error), reason: failureReason(error, hookFailureCause(error)),
|
|
19
20
|
durationMs: Number.isFinite(startedAt) ? Math.round(now() - startedAt) : null,
|
|
20
21
|
correlationId: typeof sessionId === 'string' ? sessionId : null
|
|
21
22
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderRequestError } from '../graphiti/provider-client.js';
|
|
2
|
+
import { isProviderOutage } from '../graphiti/provider-outage.js';
|
|
2
3
|
|
|
3
4
|
// Only this first, read-only lookup can be deferred before a scope is known.
|
|
4
5
|
// Each real HTTP attempt is bounded; writes and later handoff operations are
|
|
@@ -30,9 +31,7 @@ export async function lookupTranscriptTask(application, input, sourceApplication
|
|
|
30
31
|
code: 'current_task_endpoint_unavailable',
|
|
31
32
|
reason: 'Visible transcript synchronization is not available on this Fuli provider version' } };
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|| (error.code === 'provider_http_5xx' && [502, 503, 504].includes(error.status));
|
|
35
|
-
if (!transient) throw error;
|
|
34
|
+
if (!isProviderOutage(error)) throw error;
|
|
36
35
|
if (attempt === 1) return { failure: { status: 'unsaved', entryBlocked: true,
|
|
37
36
|
code: 'current_task_lookup_unavailable',
|
|
38
37
|
reason: 'Visible transcript synchronization is temporarily unavailable after bounded retries; native history remains available for a later verified task entry' } };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { recoverProviderOutage } from './provider-outage.js';
|
|
2
|
+
|
|
3
|
+
// rec#39: the first checkpoint call binds its input, so a call the Graph
|
|
4
|
+
// Provider never answered finishes only when resent unchanged. Say so instead
|
|
5
|
+
// of a bare timeout, which led Agents to retry with new wording and be refused.
|
|
6
|
+
const GUIDANCE = 'This checkpoint did not finish because FULI\'s graph service did not answer. ' +
|
|
7
|
+
'FULI may already keep its input, so retry checkpoint_task_knowledge with exactly the same arguments; changed wording is refused. ' +
|
|
8
|
+
'Until a retry returns checkpointed, do not claim the task was saved; end with the entry agent_receipt. ' +
|
|
9
|
+
'If the retry fails again, say in one line that FULI could not save this task yet.';
|
|
10
|
+
|
|
11
|
+
export function checkpointIncomplete(error) {
|
|
12
|
+
return {
|
|
13
|
+
status: 'checkpoint_incomplete',
|
|
14
|
+
reason: error.code,
|
|
15
|
+
checkpoint_required: true,
|
|
16
|
+
retry: { tool: 'checkpoint_task_knowledge', same_input: true, attempts: 1 },
|
|
17
|
+
guidance: GUIDANCE
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function withCheckpointOutageStatus(checkpoint) {
|
|
22
|
+
return recoverProviderOutage(checkpoint, checkpointIncomplete);
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ProviderRequestError } from './provider-client.js';
|
|
2
|
+
|
|
3
|
+
// The Graph Provider did not answer (not running, restarting, or a gateway in
|
|
4
|
+
// front of it failed): a later attempt may succeed. A refusal or a bad request
|
|
5
|
+
// is an answer and never counts.
|
|
6
|
+
export function isProviderOutage(error) {
|
|
7
|
+
if (!(error instanceof ProviderRequestError)) return false;
|
|
8
|
+
return ['provider_unavailable', 'provider_timeout'].includes(error.code)
|
|
9
|
+
|| (error.code === 'provider_http_5xx' && [502, 503, 504].includes(error.status));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Runs work; an outage becomes recover(error)'s bounded answer, anything else fails as before.
|
|
13
|
+
export async function recoverProviderOutage(work, recover) {
|
|
14
|
+
try {
|
|
15
|
+
return await work;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (isProviderOutage(error)) return recover(error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -23,6 +23,7 @@ export async function beginTaskContext(application, {
|
|
|
23
23
|
sourceSessionId = null,
|
|
24
24
|
projectAgentId = null,
|
|
25
25
|
workKind,
|
|
26
|
+
promptScene,
|
|
26
27
|
workflow,
|
|
27
28
|
requiredCapabilities = []
|
|
28
29
|
}) {
|
|
@@ -40,8 +41,15 @@ export async function beginTaskContext(application, {
|
|
|
40
41
|
if (existingTask && personalProjectId && existingTask.personalProjectId !== personalProjectId) {
|
|
41
42
|
throw validationError('Task context belongs to another project');
|
|
42
43
|
}
|
|
44
|
+
// A scene a hook read from the prompt (task-scene.js) is a hint: it scopes a
|
|
45
|
+
// new task only. Codex runs the prompt hook again, with the same turn_id, for
|
|
46
|
+
// input that arrives while the turn runs (an async question's reply, a
|
|
47
|
+
// steering message: codex-rs/core/src/hook_runtime.rs inspect_pending_input);
|
|
48
|
+
// that input keeps the scene its turn entered with (rec#85). An explicit
|
|
49
|
+
// workKind is still refused when it differs. Only the hooks send promptScene,
|
|
50
|
+
// in-process; it is not part of the MCP tool schema.
|
|
43
51
|
const preferenceScope = existingTask ? taskPreferenceScope(existingTask.preferenceScope)
|
|
44
|
-
: taskPreferenceScope({ version: 1, work_kind: workKind ?? null, workflow: workflow ?? null });
|
|
52
|
+
: taskPreferenceScope({ version: 1, work_kind: workKind ?? promptScene ?? null, workflow: workflow ?? null });
|
|
45
53
|
if (!preferenceScope) throw validationError('Task preference scope is unknown; legacy recovery cannot guess preference dimensions');
|
|
46
54
|
if (existingTask && ((workKind !== undefined && workKind !== preferenceScope.work_kind) ||
|
|
47
55
|
(workflow !== undefined && workflow !== preferenceScope.workflow))) {
|
|
@@ -49,7 +49,7 @@ export function beginTaskEntry(application, input) {
|
|
|
49
49
|
entry = await beginTaskContext(application, input);
|
|
50
50
|
} catch (error) {
|
|
51
51
|
if (!isReadOnlyRefusal(error)) throw error;
|
|
52
|
-
return readOnlyTaskEntry(application, input);
|
|
52
|
+
return readOnlyTaskEntry(application, { ...input, workKind: input.workKind ?? input.promptScene });
|
|
53
53
|
}
|
|
54
54
|
keepEntryPrompt(application, entry, input, input.taskPrompt);
|
|
55
55
|
// Its task and opening writes are done: a hook deadline from here on
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { recoverProviderOutage } from './provider-outage.js';
|
|
2
|
+
|
|
3
|
+
// rec#105: preferences live in the Graph Provider, so while it does not answer
|
|
4
|
+
// the entry cannot deliver them. The Agent gets a bounded status that says so
|
|
5
|
+
// and what to do next, instead of a bare error that drops the whole task entry.
|
|
6
|
+
const GUIDANCE = 'FULI could not read preferences because its graph service did not answer. ' +
|
|
7
|
+
'No task token or receipt was returned. Continue the user task without FULI preferences; never invent them or reuse an earlier token. ' +
|
|
8
|
+
'Call get_collaboration_preferences once more before any FULI write or your final reply; if it fails again, say in one line that FULI was unavailable.';
|
|
9
|
+
|
|
10
|
+
export function preferencesUnavailableEntry(error) {
|
|
11
|
+
return {
|
|
12
|
+
status: 'preferences_unavailable',
|
|
13
|
+
reason: error.code,
|
|
14
|
+
checkpoint_required: false,
|
|
15
|
+
preference_delivery: { status: 'unavailable' },
|
|
16
|
+
task_lifecycle: { status: 'not_started', reason: 'provider_unavailable' },
|
|
17
|
+
task_knowledge_recall: { status: 'unavailable' },
|
|
18
|
+
retry: { tool: 'get_collaboration_preferences', attempts: 1 },
|
|
19
|
+
guidance: GUIDANCE
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function withProviderOutageEntry(entry) {
|
|
24
|
+
return recoverProviderOutage(entry, preferencesUnavailableEntry);
|
|
25
|
+
}
|
|
@@ -87,7 +87,7 @@ export async function checkpointTaskKnowledge(application, {
|
|
|
87
87
|
)).digest('hex');
|
|
88
88
|
if (task.checkpoint && task.checkpoint.fingerprint !== fingerprint) {
|
|
89
89
|
throw validationError(
|
|
90
|
-
'Task checkpoint already has different input;
|
|
90
|
+
'Task checkpoint already has different input; resend the exact arguments of the first checkpoint call to finish it, or begin a new task context'
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
const finish = async (result, checkpointTask = task, memory = null) => {
|
|
@@ -67,7 +67,7 @@ export function taskWorkKind(prompt) {
|
|
|
67
67
|
// begin_task_context arguments from a hook: an unclassified prompt sends none.
|
|
68
68
|
export function taskSceneInput(prompt) {
|
|
69
69
|
const workKind = taskWorkKind(prompt);
|
|
70
|
-
return workKind ? { workKind } : {};
|
|
70
|
+
return workKind ? { promptScene: workKind } : {};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// The work kinds an item's tasteDomain names: undefined when it states none,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { jsonSchemaToZod, openObjectSchema } from './tool-schema.js';
|
|
36
36
|
import { assertToolInputWithinBudget, createToolInputValidator } from './tool-input-budget.js';
|
|
37
37
|
import { nativeSessionFromEnv } from '../agents/native-session-env.js';
|
|
38
|
+
import { callSourceApplication } from '../agents/call-source.js';
|
|
38
39
|
import {
|
|
39
40
|
isFuliProcessSession,
|
|
40
41
|
mcpHostSessionId,
|
|
@@ -285,12 +286,14 @@ function createToolMap(
|
|
|
285
286
|
requestContext
|
|
286
287
|
);
|
|
287
288
|
|
|
288
|
-
function invokeAsHost() {
|
|
289
|
-
const
|
|
290
|
-
|
|
289
|
+
async function invokeAsHost() {
|
|
290
|
+
const prepared = prepareToolInput(definition.name, input);
|
|
291
|
+
const callSource = await callSourceApplication(app, sourceApplication, prepared);
|
|
292
|
+
const normalized = normalizeAgentSessionInput(definition.name, prepared,
|
|
293
|
+
requestNative, requestHost, clock, callSource);
|
|
291
294
|
onSession(callingSession(definition.name, normalized, requestNative));
|
|
292
295
|
return invokeAgentTool(app, definition.name, normalized, projectActionPreviews, commonKnowledgePreviews,
|
|
293
|
-
agentHostRequestContext({ ...requestContext, testToolsEnabled: includeTestTools }, requestHost,
|
|
296
|
+
agentHostRequestContext({ ...requestContext, testToolsEnabled: includeTestTools }, requestHost, callSource));
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
}]));
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
// and writes its digest here before publishing (scripts/pin-win-helper.js); a
|
|
4
4
|
// source checkout has no helper and no pin, so Windows Hello is unavailable there.
|
|
5
5
|
// The helper is not Authenticode-signed: this digest is its only integrity check.
|
|
6
|
-
export const WIN_HELPER_SHA256 = '
|
|
6
|
+
export const WIN_HELPER_SHA256 = 'aead2364633a3bba4b92cfec44a28691d48692d96271e4e21709df72b6878c45';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.25.1",
|
|
3
|
+
"zh": [
|
|
4
|
+
"一个小修版:FLA 之间喊人更靠谱了,喊不醒的不会再一直占着位子。",
|
|
5
|
+
"图谱服务打个盹时,任务照常开始,记录也能原样补存。",
|
|
6
|
+
"Claude 桌面版的 Code 标签页里,圆桌回复和记录不再报错。"
|
|
7
|
+
],
|
|
8
|
+
"en": [
|
|
9
|
+
"A small fix release: FLAs reach each other, and a stuck wake no longer blocks one forever.",
|
|
10
|
+
"When the graph service naps, tasks still start and a checkpoint can be finished by sending it again.",
|
|
11
|
+
"In Claude Desktop's Code tab, roundtable replies and checkpoints work again."
|
|
12
|
+
]
|
|
13
|
+
}
|