@orion-agents/orion-code 0.4.3 → 0.4.5
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/CHANGELOG.md +14 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/acp/session-updates.d.ts +4 -3
- package/dist/acp/session-updates.js +23 -2
- package/dist/acp/sessions.js +19 -6
- package/dist/commands/core-command-handlers.js +10 -22
- package/dist/commands/diagnostic-command-handlers.js +48 -52
- package/dist/commands/registry.js +1 -1
- package/dist/commands/target-command.js +49 -6
- package/dist/commands/workflow-commands.js +2 -2
- package/dist/core/tool-artifacts.js +17 -4
- package/dist/framework/loop-budget-contract.d.ts +1 -12
- package/dist/framework/loop-budget-contract.js +1 -7
- package/dist/framework/loop-progress.d.ts +3 -7
- package/dist/framework/loop-progress.js +7 -23
- package/dist/framework/query.d.ts +12 -24
- package/dist/framework/query.js +294 -301
- package/dist/framework/tool-state.d.ts +4 -0
- package/dist/harness/assembler.js +1 -1
- package/dist/harness/context-harness.d.ts +12 -2
- package/dist/harness/context-harness.js +288 -60
- package/dist/harness/contract.js +3 -1
- package/dist/harness/drift-guard.js +67 -17
- package/dist/harness/goal-verification.d.ts +11 -0
- package/dist/harness/goal-verification.js +62 -0
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/ledger.d.ts +1 -0
- package/dist/harness/ledger.js +28 -4
- package/dist/harness/progress-controller.js +57 -35
- package/dist/harness/state.js +4 -0
- package/dist/harness/stop-controller.d.ts +0 -5
- package/dist/harness/stop-controller.js +11 -31
- package/dist/harness/task-checklist.d.ts +12 -2
- package/dist/harness/task-checklist.js +50 -9
- package/dist/harness/types.d.ts +15 -0
- package/dist/harness/verification.d.ts +11 -1
- package/dist/harness/verification.js +47 -2
- package/dist/print-ui/event-stream.d.ts +5 -0
- package/dist/print-ui/event-stream.js +22 -5
- package/dist/runtime/agent-loop.d.ts +2 -1
- package/dist/runtime/agent-loop.js +23 -17
- package/dist/runtime/agent-runtime-controller.d.ts +1 -1
- package/dist/runtime/agent-runtime-controller.js +21 -11
- package/dist/runtime/batch-read-service.js +21 -4
- package/dist/runtime/goal-lifecycle-v2.d.ts +6 -4
- package/dist/runtime/goal-lifecycle-v2.js +164 -56
- package/dist/runtime/goal-runtime-coordinator.d.ts +6 -3
- package/dist/runtime/goal-runtime-coordinator.js +91 -36
- package/dist/runtime/goals/presentation.js +3 -1
- package/dist/runtime/goals/types.d.ts +1 -3
- package/dist/runtime/goals/types.js +0 -3
- package/dist/runtime/loop-budget.d.ts +0 -7
- package/dist/runtime/loop-budget.js +8 -54
- package/dist/runtime/orion-runtime-v1.js +55 -14
- package/dist/runtime/product-orion-runtime.js +30 -13
- package/dist/runtime/rsi/evaluation.js +1 -7
- package/dist/runtime/step-snapshot.d.ts +3 -1
- package/dist/runtime/step-snapshot.js +11 -1
- package/dist/runtime/subagent-thread-runtime.js +27 -5
- package/dist/runtime/subagents/production.js +0 -4
- package/dist/runtime/task-context-recovery.js +30 -7
- package/dist/runtime/task-context-service.d.ts +7 -1
- package/dist/runtime/task-context-service.js +40 -8
- package/dist/runtime/thread-admission.d.ts +2 -0
- package/dist/runtime/thread-admission.js +9 -1
- package/dist/runtime/thread-runtime.d.ts +3 -0
- package/dist/runtime/thread-runtime.js +42 -3
- package/dist/runtime/thread-ui-adapter.js +1 -11
- package/dist/runtime/tool-gateway.d.ts +2 -0
- package/dist/runtime/tool-gateway.js +4 -0
- package/dist/runtime/tool-receipt-validator.js +4 -0
- package/dist/runtime/ui-events.d.ts +3 -1
- package/dist/runtime/ui-view-model.js +62 -59
- package/dist/runtime/workspace-verification.d.ts +7 -0
- package/dist/runtime/workspace-verification.js +98 -0
- package/dist/services/chat-completion-sse.d.ts +9 -0
- package/dist/services/chat-completion-sse.js +50 -0
- package/dist/services/compact/summary-generator.d.ts +1 -1
- package/dist/services/compact/summary-generator.js +12 -0
- package/dist/services/config.js +3 -7
- package/dist/services/global-config.d.ts +3 -11
- package/dist/services/global-config.js +36 -26
- package/dist/services/llm.d.ts +3 -1
- package/dist/services/llm.js +171 -285
- package/dist/services/provider-diagnostics.d.ts +2 -1
- package/dist/services/provider-diagnostics.js +15 -4
- package/dist/services/provider-resilience/error-classifier.d.ts +3 -0
- package/dist/services/provider-resilience/error-classifier.js +14 -0
- package/dist/tools/core/common.d.ts +0 -11
- package/dist/tools/core/common.js +0 -18
- package/dist/tools/core/edit-file.js +61 -88
- package/dist/tools/core/exec-command.js +61 -80
- package/dist/tools/core/grep.js +84 -24
- package/dist/tools/core/read-file.js +3 -2
- package/dist/tools/core/write-file.js +5 -3
- package/dist/tools/todo.d.ts +2 -2
- package/dist/tools/todo.js +29 -10
- package/dist/tui-ui/chrome-view-model.js +15 -6
- package/dist/utils/utf8.d.ts +6 -0
- package/dist/utils/utf8.js +14 -0
- package/docs/cli-guide.md +58 -40
- package/docs/orion.example.yaml +4 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -54,9 +54,11 @@ async function writeFileSync_(path, content, cwd) {
|
|
|
54
54
|
const previous = (0, common_1.safeStatSync)(resolved);
|
|
55
55
|
const bytes = Buffer.byteLength(content, 'utf8');
|
|
56
56
|
const previousText = previous && previous.size === bytes && previous.isFile() ? (0, common_1.safeReadFileSync)(resolved) : null;
|
|
57
|
-
const changed =
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const changed = previousText !== content;
|
|
58
|
+
if (changed) {
|
|
59
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(resolved), { recursive: true });
|
|
60
|
+
(0, fs_1.writeFileSync)(resolved, content, 'utf-8');
|
|
61
|
+
}
|
|
60
62
|
return {
|
|
61
63
|
success: true,
|
|
62
64
|
output: `Wrote ${content.split('\n').length} lines to ${normalizedPath}`,
|
package/dist/tools/todo.d.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* The caller owns the checklist state. The production runtime saves it in TaskContext.
|
|
7
7
|
*/
|
|
8
8
|
import { type OrionCodeTool } from '../framework/tool';
|
|
9
|
-
import type { TodoItem, ToolStateStore } from '../framework/tool-state';
|
|
9
|
+
import type { TodoItem, TodoWriteAdjustment, ToolStateStore } from '../framework/tool-state';
|
|
10
10
|
export declare const MAX_TODOS = 8;
|
|
11
11
|
export declare const MAX_TODO_TEXT = 120;
|
|
12
|
-
export declare function createTodoWriteTool(save: (todos: TodoItem[]) => string | void): OrionCodeTool;
|
|
12
|
+
export declare function createTodoWriteTool(save: (todos: TodoItem[], blockedReason?: string) => TodoWriteAdjustment | string | void): OrionCodeTool;
|
|
13
13
|
export declare function createTodoTools(state: ToolStateStore): OrionCodeTool[];
|
|
14
14
|
/** Get current todos (for UI display) */
|
|
15
15
|
export declare function getCurrentTodos(state: ToolStateStore): TodoItem[];
|
package/dist/tools/todo.js
CHANGED
|
@@ -21,7 +21,7 @@ const TODO_PROMPT = `Use this tool to create and manage a structured task list f
|
|
|
21
21
|
|
|
22
22
|
## When to Use This Tool
|
|
23
23
|
|
|
24
|
-
If the task context requires a checklist, create it before changing the workspace. Name the exact target paths in the implementation steps and include
|
|
24
|
+
If the task context requires a checklist, create it before changing the workspace. Name the exact target paths in the implementation steps and include verification.
|
|
25
25
|
|
|
26
26
|
1. Complex multi-step tasks - When a task requires 3 or more distinct steps
|
|
27
27
|
2. Non-trivial tasks - Tasks that require careful planning or multiple operations
|
|
@@ -56,8 +56,9 @@ For verification steps, also include verification with the required check kinds
|
|
|
56
56
|
|
|
57
57
|
- Keep at most ONE task in_progress at a time
|
|
58
58
|
- Mark tasks complete IMMEDIATELY after finishing
|
|
59
|
-
- Keep
|
|
59
|
+
- Keep descriptions stable. To clarify an unfinished step, replace its bare filename with the exact workspace-relative path.
|
|
60
60
|
- Only mark a step completed after running its work and checks while it is in progress.
|
|
61
|
+
- An implementation step with verification requires both a file change and a passing check.
|
|
61
62
|
- Run each verification command directly with exec_command and use its cwd argument for the project directory. If a check fails, retry that check successfully before completing the step.`;
|
|
62
63
|
exports.MAX_TODOS = 8;
|
|
63
64
|
exports.MAX_TODO_TEXT = 120;
|
|
@@ -70,6 +71,10 @@ ${TODO_PROMPT}`,
|
|
|
70
71
|
parameters: {
|
|
71
72
|
type: 'object',
|
|
72
73
|
properties: {
|
|
74
|
+
blockedReason: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: 'Report a concrete blocker and finish the current turn with the active step open.',
|
|
77
|
+
},
|
|
73
78
|
todos: {
|
|
74
79
|
type: 'array',
|
|
75
80
|
minItems: 1,
|
|
@@ -150,16 +155,30 @@ ${TODO_PROMPT}`,
|
|
|
150
155
|
error: 'Only one task can be in_progress at a time',
|
|
151
156
|
};
|
|
152
157
|
}
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
const blocker = args.blockedReason;
|
|
159
|
+
if (blocker !== undefined &&
|
|
160
|
+
(typeof blocker !== 'string' ||
|
|
161
|
+
!blocker.trim() ||
|
|
162
|
+
blocker.length > 400 ||
|
|
163
|
+
inProgressCount !== 1)) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
output: '',
|
|
167
|
+
error: 'A blocker requires one active todo and a reason of up to 400 characters.',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const saved = typeof blocker === 'string' ? save(normalized, blocker.trim()) : save(normalized);
|
|
171
|
+
if (typeof saved === 'string')
|
|
172
|
+
return { success: false, output: '', error: saved };
|
|
173
|
+
const applied = saved?.todos ?? normalized;
|
|
174
|
+
const completed = applied.filter(todo => todo.status === 'completed').length;
|
|
175
|
+
const current = applied.find(todo => todo.status === 'in_progress');
|
|
176
|
+
const output = [formatTodosForDisplay(applied), ...(saved?.warnings ?? [])].join('\n');
|
|
158
177
|
return {
|
|
159
178
|
success: true,
|
|
160
|
-
output
|
|
161
|
-
summary: `${completed}/${
|
|
162
|
-
metadata: { taskTodos:
|
|
179
|
+
output,
|
|
180
|
+
summary: `${completed}/${applied.length} complete${current ? ` · ${current.activeForm}` : ''}`,
|
|
181
|
+
metadata: { taskTodos: applied },
|
|
163
182
|
};
|
|
164
183
|
},
|
|
165
184
|
isReadOnly: () => false,
|
|
@@ -44,7 +44,7 @@ function createTuiChromeViewModel(state, requested = DEFAULT_ITEMS) {
|
|
|
44
44
|
? 'BUILD'
|
|
45
45
|
: state.agentMode.pendingBaseMode.toUpperCase()
|
|
46
46
|
: null;
|
|
47
|
-
const goalMode =
|
|
47
|
+
const goalMode = state.goal?.status === 'active';
|
|
48
48
|
const modeLabel = `${goalMode ? `GOAL · ${baseModeLabel}` : baseModeLabel}${pendingModeLabel ? ` → ${pendingModeLabel} NEXT` : ''}`;
|
|
49
49
|
const baseTone = state.agentMode.baseMode === 'plan'
|
|
50
50
|
? 'mode-plan'
|
|
@@ -63,7 +63,14 @@ function createTuiChromeViewModel(state, requested = DEFAULT_ITEMS) {
|
|
|
63
63
|
: '';
|
|
64
64
|
const objective = ` ${state.goal.objective}`;
|
|
65
65
|
const plan = state.goal.planPhase ? ` ${state.goal.planPhase}` : '';
|
|
66
|
-
const
|
|
66
|
+
const budgetLimited = state.goal.status === 'budget_limited';
|
|
67
|
+
const tokenLimit = budgetLimited ? state.goal.tokenBudget : undefined;
|
|
68
|
+
const timeLimit = budgetLimited ? state.goal.timeBudgetMs : undefined;
|
|
69
|
+
const tokens = formatGoalTokenUsage(state.goal.tokensUsed);
|
|
70
|
+
const usage = `tokens:${tokens}${tokenLimit === undefined ? '' : `/${formatGoalTokenUsage(tokenLimit)}`}`;
|
|
71
|
+
const time = timeLimit === undefined
|
|
72
|
+
? ''
|
|
73
|
+
: ` time:${Math.floor(state.goal.timeUsedMs / 1000)}/${timeLimit / 1000}s`;
|
|
67
74
|
const statusShowsAudit = state.statusMessage.startsWith('Goal audit failed (');
|
|
68
75
|
const audit = !statusShowsAudit && state.goal.auditRemaining?.[0]
|
|
69
76
|
? ` audit:${state.goal.auditRemaining[0]}`
|
|
@@ -71,10 +78,12 @@ function createTuiChromeViewModel(state, requested = DEFAULT_ITEMS) {
|
|
|
71
78
|
const next = state.goal.nextAction && !state.statusMessage.includes(state.goal.nextAction)
|
|
72
79
|
? ` next:${state.goal.nextAction}`
|
|
73
80
|
: '';
|
|
74
|
-
const actions =
|
|
75
|
-
?
|
|
76
|
-
: ''
|
|
77
|
-
|
|
81
|
+
const actions = budgetLimited
|
|
82
|
+
? ' /goal budget'
|
|
83
|
+
: ['paused', 'blocked', 'usage_limited'].includes(state.goal.status)
|
|
84
|
+
? ' /goal resume /goal clear'
|
|
85
|
+
: '';
|
|
86
|
+
const progressLabel = `goal:${state.goal.status}${progress}${actions} ${usage}${time}`;
|
|
78
87
|
all.set('goal', {
|
|
79
88
|
id: 'goal',
|
|
80
89
|
// Usage is the durable progress signal operators need most. Keep it at
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncateToBytes = truncateToBytes;
|
|
4
|
+
/** Clip UTF-8 text to a byte budget without splitting a character. */
|
|
5
|
+
function truncateToBytes(text, maxBytes) {
|
|
6
|
+
const buffer = Buffer.from(text, 'utf8');
|
|
7
|
+
if (buffer.length <= maxBytes)
|
|
8
|
+
return { text, bytes: buffer.length };
|
|
9
|
+
let cut = Math.max(0, maxBytes);
|
|
10
|
+
while (cut > 0 && (buffer[cut] & 0xc0) === 0x80)
|
|
11
|
+
cut--;
|
|
12
|
+
return { text: buffer.subarray(0, cut).toString('utf8'), bytes: cut };
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=utf8.js.map
|
package/docs/cli-guide.md
CHANGED
|
@@ -63,6 +63,7 @@ JSONL stdout 每行是一个独立的 JSON 对象。每条记录有 `schemaVersi
|
|
|
63
63
|
|
|
64
64
|
最后一行始终为 `result`,包含 `status`、`reasonCode`、`exitCode` 与 `resumable`。
|
|
65
65
|
进程退出码与该行一致。
|
|
66
|
+
当当前回合的持久化回执包含用量时,`result.metrics.llmRequests` 和 `result.metrics.toolCalls` 提供模型请求数和工具调用数。
|
|
66
67
|
|
|
67
68
|
| `status` | 退出码 | 含义 |
|
|
68
69
|
| --- | ---: | --- |
|
|
@@ -72,7 +73,7 @@ JSONL stdout 每行是一个独立的 JSON 对象。每条记录有 `schemaVersi
|
|
|
72
73
|
| `approval_required` | 3 | 需要交互式授权,待审批操作未执行 |
|
|
73
74
|
| `cancelled` | 130 | 请求被中断 |
|
|
74
75
|
|
|
75
|
-
`reasonCode` 细化原因,例如 `
|
|
76
|
+
`reasonCode` 细化原因,例如 `goal_time_budget`、`provider_auth_failed` 和
|
|
76
77
|
`resume_failed`。选择默认文本或 `--output-format json` 时,输出和默认退出行为继续适用。
|
|
77
78
|
为这两类输出加 `--strict-exit` 可启用上表退出码。
|
|
78
79
|
|
|
@@ -101,30 +102,39 @@ JSONL stdout 每行是一个独立的 JSON 对象。每条记录有 `schemaVersi
|
|
|
101
102
|
|
|
102
103
|
启动方式遵循 [ACP v1 stdio 规范](https://agentclientprotocol.com/protocol/v1/transports)。
|
|
103
104
|
|
|
104
|
-
## Goal
|
|
105
|
+
## Goal 续跑
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
重启不自动恢复已暂停的 Goal。该时间是活动回合累计时间,不包含用户暂停期间。
|
|
110
|
-
`/goal status` 展示已用与总量;已耗尽的 Goal 不能通过 `/goal resume` 重新获得预算。
|
|
111
|
-
需要更多资源时先检查证据、清除当前 Goal,再以适当配置明确新建 Goal。
|
|
107
|
+
明确创建的 Goal 会按会话续跑。`/goal status` 显示当前状态、累计用量、预算和可采取的操作。
|
|
108
|
+
新建 Goal 默认不设 token 或活动时间上限。可用 `agentLoop.goalBudget` 设置默认总量和授权上限,
|
|
109
|
+
也可在创建时指定单个 Goal 的限额。时间预算以毫秒计,仅累计 Goal 自身的活动回合时间。
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
```text
|
|
112
|
+
/goal --max-tokens 50000 --max-elapsed-ms 600000 -- 修复失败的测试并验证
|
|
113
|
+
/goal status
|
|
114
|
+
/goal budget --max-tokens 100000
|
|
115
|
+
/goal resume
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
进入 `budget_limited` 后,先用 `/goal budget` 授权高于已用量和原上限的新总量。如果两个资源均已
|
|
119
|
+
耗尽,需要分别提高。调整会保存新额度,随后用 `/goal resume` 继续原 Goal。Goal ID、历史、累计用量、
|
|
120
|
+
清单与证据随会话恢复。如果配置的上限较低,需要先在 `orion.yaml` 中调整上限。
|
|
121
|
+
|
|
122
|
+
`paused` 和 `blocked` 显示暂停原因。Provider 配额耗尽进入 `usage_limited`,提供方给出重试时间
|
|
123
|
+
时会一并显示。恢复服务或解决阻塞后执行 `/goal resume`。已经停止的 Goal 所在会话里,发送普通
|
|
124
|
+
`continue` 仍会走对话回合,Goal 的预算和状态保持原值。
|
|
125
|
+
|
|
126
|
+
`agentLoop.continuation: agent` 为默认值。Goal 回合结束后,运行时先保存完整工具分组、TaskContext
|
|
127
|
+
和 Goal 状态。仍处于活动状态的 Goal 在会话空闲时续跑,已排队的用户输入优先。`manual` 在每个
|
|
128
|
+
需要继续的 Goal 回合后暂停,由 `/goal resume` 启动下一回合。
|
|
117
129
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
“已完成”或失败测试都不能代替成功验证。没有 Agent 编写的 todo 时,TaskContext 使用
|
|
122
|
-
自身验收项作为工作列表,以稳定 criterion id 和证据状态展示;已通过或用户授权豁免的
|
|
123
|
-
验收项显示完成,未通过项保持待办。显式 todo 的展示优先。
|
|
130
|
+
Goal 运行时,可直接发送同类检查的更正,例如「把 `npm test -- alpha` 替换成 `npm test -- beta`」。
|
|
131
|
+
如果同一命令在多个目录都是必需检查,请同时指定原检查的工作区相对目录。更正会随 Goal 保存,
|
|
132
|
+
新检查通过后才满足该项验收。选不出唯一原检查时,Goal 会提示明确指定。
|
|
124
133
|
|
|
125
|
-
|
|
126
|
-
Goal
|
|
127
|
-
|
|
134
|
+
模型选择完成时,TaskContext 核对成功验证及其他验收证据。背景调查和失败后的排查可以继续推进。
|
|
135
|
+
切换策略、等待压缩或单次测试失败产生的状态随回合落盘。Goal 只有在证据满足时才显示 `completed`,
|
|
136
|
+
此时可在 `/goal status` 查看完成证据与累计用量。用 `/usage` 可分别查看文件改动、验证、任务状态、
|
|
137
|
+
只读探索和可见输出。
|
|
128
138
|
|
|
129
139
|
## RSI 优化项目 Skill
|
|
130
140
|
|
|
@@ -140,7 +150,7 @@ orion rsi resume --run ./rsi-run
|
|
|
140
150
|
|
|
141
151
|
`selection.json` 包含 `version: 1`、仓库根目录的绝对路径 `repository`、完整的 Git `baseCommit`、以及 1–16 条已完成或失败的持久化回合 `turns`。每条回合包含 `sessionId`、`turnId`、`category`、`result`,也可指定 `skill`。类别为 `cross_module_callers`、`local_edit_cost`、`missing_verification`、`missing_tool`,反馈结果为 `corrected`、`failed`、`accepted`。
|
|
142
152
|
|
|
143
|
-
`suite.json` 使用 `version: 1`、本地 OpenAI 兼容 `endpoint`(`http://127.0.0.1:端口/v1`)、`model`、`repeats`、`maxRequests`、`maxTools`、`maxTokens`、`timeoutMs`。每个 `tasks` 条目包含 `id`、`split`、`category`、`prompt`、初始 `files` 和 `expected`。`expected`
|
|
153
|
+
`suite.json` 使用 `version: 1`、本地 OpenAI 兼容 `endpoint`(`http://127.0.0.1:端口/v1`)、`model`、`repeats`、`maxRequests`、`maxTools`、`maxTokens`、`timeoutMs`。每个 `tasks` 条目包含 `id`、`split`、`category`、`prompt`、初始 `files` 和 `expected`。`expected` 指定允许修改的路径及其验收全文,其余文件保持原样。留出组覆盖四类任务,开发组使用独立样本。为本地兼容服务选择固定模型,两组共用同一模型档案。`timeoutMs` 限制每组评估进程的运行时间。请求数、工具数或 token 超出评估额度时,结果为 `inconclusive`。样本提示和 fixture 文件可能进入操作者选中的本地模型服务,输入应使用获准的测试数据。
|
|
144
154
|
|
|
145
155
|
`propose --input selection.json --out ./rsi-run` 可单独生成提案;之后运行 `evaluate --run ./rsi-run --suite suite.json`。取消或中断后,`resume` 继续还未领取的配对,已发起但未完整记录的配对保留为 `indeterminate`。重复执行复用已有收据。源代码中 `scripts/smoke/rsi-proposal-smoke.py` 的 `task_suite` 函数提供完整样本。
|
|
146
156
|
|
|
@@ -174,14 +184,11 @@ orion rsi observe --run ./rsi-run --input rollback-follow-up.json
|
|
|
174
184
|
额度耗尽后,每个结果仍保留最多 2 KiB 的恢复预览(显式单结果上限更低时取较低值),
|
|
175
185
|
保留实际成功/失败、错误及可容纳的正文,不再用同一遗漏提示替代随后的小结果。
|
|
176
186
|
完整输出及 artifact 引用仍通过原始工具事件保存。预览不是完整文件,截断不代表命令失败。
|
|
177
|
-
|
|
178
|
-
实际字节数包含 JSON 信封并如实计入统计,不通过少计字节规避预算。
|
|
187
|
+
共享额度是压缩阈值。实际字节数包含 JSON 信封,模型上下文达到容量边界时由压缩恢复处理。
|
|
179
188
|
|
|
180
189
|
普通 BUILD/AUTO 回合有成功工具结果、模型可见工具输出用到共享额度的 90% 时,可尝试一次本地
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
工具调用上限和累计字节统计照常生效。达到最终上限时,终端显示停止原因和恢复方式,可用 `/usage`
|
|
184
|
-
查看档位、用量及上限。Goal 续跑仍由 Goal 自己的检查点和总预算决定。
|
|
190
|
+
压缩。压缩会保留完整工具分组和原始记录,且无需额外模型摘要请求。`/usage` 显示模型请求数、
|
|
191
|
+
工具调用数和当前的工具结果压缩额度。
|
|
185
192
|
|
|
186
193
|
每个模型可见结果的 `metadata` 包含 `budgetLimitBytes`、`budgetRemainingBytes`、
|
|
187
194
|
`budgetExhausted` 和 `budgetSnapshot: before_result`,明确表示该结果加入前的余额。
|
|
@@ -221,6 +228,25 @@ Agent 应按预估字节安排批量读取,优先读取行范围或搜索命
|
|
|
221
228
|
[变更记录](../CHANGELOG.md)和[中文快速开始](../README.zh-CN.md)不承诺 npm 已发布;
|
|
222
229
|
registry、tag、Release 与本地安装状态需要独立核验。
|
|
223
230
|
|
|
231
|
+
### npm 自动发布
|
|
232
|
+
|
|
233
|
+
正式版以 `main` 上的 `package.json` 中 `version` 为准。发布 PR 同步更新
|
|
234
|
+
`npm-shrinkwrap.json`、`CHANGELOG.md` 和两份 README 的版本说明及安装命令。
|
|
235
|
+
版本须是高于 npm 当前 `latest` 的新稳定版。当前版本和预发布版本会跳过。
|
|
236
|
+
首次上传后会等待 npm Registry 处理。目标版本已经可见但 `latest` 尚未更新时,
|
|
237
|
+
重新运行会验证已有包的完整性并继续等待,避免重复上传。
|
|
238
|
+
|
|
239
|
+
`main` 的 CI 通过后,`npm-publish.yml` 下载该次 CI 的 `release-package` 和
|
|
240
|
+
`release-receipt`。它核对 `GO`、源提交、版本与 tarball 校验值,再将同一个包发布到
|
|
241
|
+
`@orion-agents/orion-code` 的 `latest`,并从 npm registry 核对标签和包完整性。
|
|
242
|
+
`main` 已推进时由新提交的 CI 接续。重新通过门禁即可处理仍未发布的版本。
|
|
243
|
+
|
|
244
|
+
首次在 [npm 包设置](https://www.npmjs.com/package/@orion-agents/orion-code/access) 绑定 GitHub Actions
|
|
245
|
+
Trusted Publisher。仓库填 `orion-agents/orion-code`,工作流填 `npm-publish.yml`,环境填
|
|
246
|
+
`npm-release`,启用 **Allow npm publish**。GitHub 的 `npm-release` 环境限定 `main` 分支。
|
|
247
|
+
绑定后两天内完成首次正式发布,后续由工作流通过 OIDC 自动认证。
|
|
248
|
+
[npm Trusted Publishing 说明](https://docs.npmjs.com/trusted-publishers/)
|
|
249
|
+
|
|
224
250
|
## YAML 配置参数参考
|
|
225
251
|
|
|
226
252
|
初始化只需配置模型连接,内置工具和已接入的扩展工具默认可用。
|
|
@@ -404,16 +430,12 @@ projects:
|
|
|
404
430
|
会话存储维护最近激活的会话。`/resume --last` 优先加载当前项目最近激活且可恢复的会话,
|
|
405
431
|
否则按项目历史选择。`/resume` 仍可从列表选择。
|
|
406
432
|
|
|
407
|
-
###
|
|
433
|
+
### 工具输出与 Goal 预算
|
|
408
434
|
|
|
409
435
|
```yaml
|
|
410
436
|
agentLoop:
|
|
411
437
|
continuation: agent
|
|
412
|
-
budgetPolicy: fixed
|
|
413
438
|
budget:
|
|
414
|
-
maxLlmRequestsPerUserTurn: 24
|
|
415
|
-
maxToolCallsPerUserTurn: 120
|
|
416
|
-
maxReadOnlyFragmentation: 3
|
|
417
439
|
maxModelVisibleToolBytes: 65536
|
|
418
440
|
goalBudget:
|
|
419
441
|
maxTokens: 1000000
|
|
@@ -423,17 +445,13 @@ agentLoop:
|
|
|
423
445
|
| 字段 | 省略时的行为/单位 |
|
|
424
446
|
| --- | --- |
|
|
425
447
|
| `continuation` | 默认 `agent`;`manual` 每次 Goal 回合后暂停,等待明确 resume |
|
|
426
|
-
| `budgetPolicy` | BUILD / AUTO 默认 `adaptive`,依据实际工具结果判断是否继续。`fixed` 按设定的请求上限停止 |
|
|
427
|
-
| `budget.maxLlmRequestsPerUserTurn` | 显式填写即启用硬上限。默认 `24`、复杂 `48`、发布 `64` 在自适应模式下用作进度检查点 |
|
|
428
|
-
| `budget.maxToolCallsPerUserTurn` | 默认 `120` 次工具调用;复杂/发布档位 `180 / 240` |
|
|
429
|
-
| `budget.maxReadOnlyFragmentation` | 默认 `3`;连续单个只读调用后注入批量读取建议,不是并发数 |
|
|
430
448
|
| `budget.maxModelVisibleToolBytes` | 默认 `65536` bytes;复杂/发布档位 `98304 / 131072`;是压缩额度,详见工具输出预算 |
|
|
431
449
|
| `goalBudget.maxTokens` | 新建 Goal 默认总预算 `1000000` tokens,含模型请求累计用量 |
|
|
432
450
|
| `goalBudget.maxElapsedMs` | 新建 Goal 默认 `7200000` 毫秒,即两小时活动回合累计时间 |
|
|
433
451
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
452
|
+
这些数字均须为正安全整数。模型根据收到的工具结果决定是否继续,`/usage` 显示模型请求数、工具调用数和停止原因。
|
|
453
|
+
Orion 读取旧配置时会忽略 `budgetPolicy`、`maxLlmRequestsPerUserTurn`、`maxToolCallsPerUserTurn` 和 `maxReadOnlyFragmentation`,下次保存规范 YAML 时移除这些键。
|
|
454
|
+
新建 Goal 使用配置中的累计 token 和活跃耗时预算。修改 YAML 或重启后,已有 Goal 继续使用保存的预算和用量。预算到期会停止活动回合并暂停 Goal。只有用户明确创建的 Goal 才能自动续作。
|
|
437
455
|
|
|
438
456
|
### TUI
|
|
439
457
|
|
package/docs/orion.example.yaml
CHANGED
|
@@ -28,11 +28,12 @@ defaultModel: example-model
|
|
|
28
28
|
|
|
29
29
|
# Optional: only explicitly created Goals may continue autonomously.
|
|
30
30
|
# agentLoop:
|
|
31
|
-
# budgetPolicy: adaptive # fixed uses the selected profile's request cap
|
|
32
31
|
# continuation: agent # manual pauses after each Goal turn
|
|
32
|
+
# budget:
|
|
33
|
+
# maxModelVisibleToolBytes: 65536
|
|
33
34
|
# goalBudget:
|
|
34
|
-
# maxTokens: 1000000
|
|
35
|
-
# maxElapsedMs: 7200000 #
|
|
35
|
+
# maxTokens: 1000000 # optional default and authorization ceiling
|
|
36
|
+
# maxElapsedMs: 7200000 # optional default and ceiling for active Goal time
|
|
36
37
|
|
|
37
38
|
# Optional TUI settings
|
|
38
39
|
# ui:
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-agents/orion-code",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@orion-agents/orion-code",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.5",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@agentclientprotocol/sdk": "2.12.0",
|