omnius 1.0.275 → 1.0.276
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/index.js +65 -7
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/prompts/agentic/conventions.md +88 -0
package/dist/index.js
CHANGED
|
@@ -566955,6 +566955,7 @@ ${parts.join("\n")}
|
|
|
566955
566955
|
*
|
|
566956
566956
|
* Instruction hierarchy (arXiv:2404.13208):
|
|
566957
566957
|
* - Priority 0: c_instr (system instructions — immutable rules)
|
|
566958
|
+
* - Priority 5: c_conventions (coding conventions — repo-specific rules)
|
|
566958
566959
|
* - Priority 10: c_state (personality, project context)
|
|
566959
566960
|
* - Priority 20: c_know (retrieved knowledge, dynamic context)
|
|
566960
566961
|
* - Priority 30: c_tools (tool definitions — handled separately by API)
|
|
@@ -566986,6 +566987,14 @@ ${parts.join("\n")}
|
|
|
566986
566987
|
content: basePromptWithBatching,
|
|
566987
566988
|
tokenEstimate: Math.ceil(basePromptWithBatching.length / 4)
|
|
566988
566989
|
});
|
|
566990
|
+
const _conventionsPrompt = loadPrompt("agentic/conventions.md");
|
|
566991
|
+
sections.push({
|
|
566992
|
+
label: "c_conventions",
|
|
566993
|
+
content: `
|
|
566994
|
+
|
|
566995
|
+
${_conventionsPrompt}`,
|
|
566996
|
+
tokenEstimate: Math.ceil(_conventionsPrompt.length / 4)
|
|
566997
|
+
});
|
|
566989
566998
|
const personalitySuffix = this.options.personality ? compilePersonalityPrompt(this.options.personality, this.options.personalityName) : "";
|
|
566990
566999
|
if (personalitySuffix) {
|
|
566991
567000
|
sections.push({
|
|
@@ -582424,20 +582433,28 @@ var init_cascadeBackend = __esm({
|
|
|
582424
582433
|
} catch (err) {
|
|
582425
582434
|
this.consecutiveFailures++;
|
|
582426
582435
|
if (this.isTransientError(err) && this.consecutiveFailures >= this.maxFailures) {
|
|
582436
|
+
const currentBackend = this.getActiveBackend();
|
|
582437
|
+
try {
|
|
582438
|
+
const result = await currentBackend.chatCompletion(request);
|
|
582439
|
+
this.consecutiveFailures = 0;
|
|
582440
|
+
return result;
|
|
582441
|
+
} catch {
|
|
582442
|
+
this.consecutiveFailures++;
|
|
582443
|
+
}
|
|
582427
582444
|
const candidates = this.endpoints.filter((_ep, i2) => i2 !== this.activeIndex && _ep.modelAvailable !== false);
|
|
582428
582445
|
if (candidates.length > 0) {
|
|
582429
|
-
const
|
|
582446
|
+
const fromEp = this.endpoints[this.activeIndex];
|
|
582430
582447
|
const reason = `${this.consecutiveFailures} consecutive failures: ${err instanceof Error ? err.message : String(err)}`;
|
|
582431
582448
|
const promises = candidates.map((ep) => {
|
|
582432
582449
|
const bk = this.backends.get(ep.url);
|
|
582433
582450
|
return bk.chatCompletion(request).then((result) => ({ result, from: ep }));
|
|
582434
582451
|
});
|
|
582435
582452
|
try {
|
|
582436
|
-
const { result, from:
|
|
582437
|
-
const winnerIdx = this.endpoints.indexOf(
|
|
582453
|
+
const { result, from: from3 } = await Promise.race(promises);
|
|
582454
|
+
const winnerIdx = this.endpoints.indexOf(from3);
|
|
582438
582455
|
if (winnerIdx >= 0) {
|
|
582439
582456
|
this.activeIndex = winnerIdx;
|
|
582440
|
-
this.onSwitch?.(
|
|
582457
|
+
this.onSwitch?.(fromEp, from3, reason);
|
|
582441
582458
|
}
|
|
582442
582459
|
this.consecutiveFailures = 0;
|
|
582443
582460
|
return result;
|
|
@@ -582499,6 +582516,30 @@ var init_cascadeBackend = __esm({
|
|
|
582499
582516
|
} catch (err) {
|
|
582500
582517
|
this.consecutiveFailures++;
|
|
582501
582518
|
if (this.isTransientError(err) && this.consecutiveFailures >= this.maxFailures) {
|
|
582519
|
+
try {
|
|
582520
|
+
const result = await backend.chatCompletion(request);
|
|
582521
|
+
this.consecutiveFailures = 0;
|
|
582522
|
+
const choice = result.choices[0];
|
|
582523
|
+
if (choice?.message.content) {
|
|
582524
|
+
yield { type: "content", content: choice.message.content };
|
|
582525
|
+
}
|
|
582526
|
+
if (choice?.message.toolCalls) {
|
|
582527
|
+
for (let i2 = 0; i2 < choice.message.toolCalls.length; i2++) {
|
|
582528
|
+
const tc = choice.message.toolCalls[i2];
|
|
582529
|
+
yield {
|
|
582530
|
+
type: "tool_call_delta",
|
|
582531
|
+
toolCallIndex: i2,
|
|
582532
|
+
toolCallId: tc.id,
|
|
582533
|
+
toolCallName: tc.name,
|
|
582534
|
+
toolCallArgs: JSON.stringify(tc.arguments)
|
|
582535
|
+
};
|
|
582536
|
+
}
|
|
582537
|
+
}
|
|
582538
|
+
yield { type: "finish", finishReason: "stop" };
|
|
582539
|
+
return;
|
|
582540
|
+
} catch {
|
|
582541
|
+
this.consecutiveFailures++;
|
|
582542
|
+
}
|
|
582502
582543
|
const nextIdx = this.findNextAvailableEndpoint();
|
|
582503
582544
|
if (nextIdx !== null && nextIdx !== this.activeIndex) {
|
|
582504
582545
|
const from3 = this.endpoints[this.activeIndex];
|
|
@@ -597247,6 +597288,11 @@ function wrapPlainLine(line, width, prefix = "") {
|
|
|
597247
597288
|
}
|
|
597248
597289
|
const lastLine = prefix ? prefix + remaining : remaining;
|
|
597249
597290
|
out.push(lastLine);
|
|
597291
|
+
if (/^>\s/.test(line)) {
|
|
597292
|
+
for (let i2 = 1; i2 < out.length; i2++) {
|
|
597293
|
+
out[i2] = "> " + out[i2].replace(/^\s*/, "");
|
|
597294
|
+
}
|
|
597295
|
+
}
|
|
597250
597296
|
return out;
|
|
597251
597297
|
}
|
|
597252
597298
|
function hangingIndentForPlainLine(line, width) {
|
|
@@ -606690,6 +606736,7 @@ __export(status_bar_exports, {
|
|
|
606690
606736
|
StatusBar: () => StatusBar,
|
|
606691
606737
|
lockFooterRedraws: () => lockFooterRedraws,
|
|
606692
606738
|
refreshThemeVars: () => refreshThemeVars,
|
|
606739
|
+
setTermTitleWriter: () => setTermTitleWriter,
|
|
606693
606740
|
setTerminalTitle: () => setTerminalTitle,
|
|
606694
606741
|
unlockFooterRedraws: () => unlockFooterRedraws
|
|
606695
606742
|
});
|
|
@@ -606732,13 +606779,21 @@ function sanitizeSponsorHeaderColor(value2) {
|
|
|
606732
606779
|
const color = Number(value2);
|
|
606733
606780
|
return Number.isInteger(color) && color >= 0 && color <= 255 ? color : 214;
|
|
606734
606781
|
}
|
|
606782
|
+
function setTermTitleWriter(writer) {
|
|
606783
|
+
_termTitleWriter = writer;
|
|
606784
|
+
}
|
|
606735
606785
|
function setTerminalTitle(task, version4) {
|
|
606736
606786
|
if (!process.stdout.isTTY) return;
|
|
606737
606787
|
const ver = version4 ? `Omnius v${version4}` : "Omnius";
|
|
606738
606788
|
const title = task ? `${task.slice(0, 60)} · ${ver}` : ver;
|
|
606739
|
-
|
|
606789
|
+
const data = `\x1B]2;${title}\x07`;
|
|
606790
|
+
if (_termTitleWriter) {
|
|
606791
|
+
_termTitleWriter(data);
|
|
606792
|
+
} else {
|
|
606793
|
+
process.stdout.write(data);
|
|
606794
|
+
}
|
|
606740
606795
|
}
|
|
606741
|
-
var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, CODE_READ_CHARS_PER_SEC, PROSE_READ_CHARS_PER_SEC, MIN_CONTENT_FOR_READING, CODE_CONTENT_TOOLS, PROSE_CONTENT_TOOLS, HumanSpeedTracker, PANEL_BG_SEQ, CONTENT_BG_SEQ, BOX_FG, TEXT_PRIMARY, TEXT_DIM, NO_SUB_AGENTS_HEADER_LABEL, HEADER_ACCENT_GREEN, HEADER_ACCENT_BOLD_FG, HEADER_BUTTON_BG, HEADER_BUTTON_FG, BOX_TL3, BOX_TR3, BOX_BL3, BOX_BR3, BOX_H3, BOX_V3, _globalFooterLock, RESET4, CURSOR_BLINK_BLOCK, _isWindows, SPONSOR_HEADER_LABEL_MAX, StatusBar;
|
|
606796
|
+
var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, CODE_READ_CHARS_PER_SEC, PROSE_READ_CHARS_PER_SEC, MIN_CONTENT_FOR_READING, CODE_CONTENT_TOOLS, PROSE_CONTENT_TOOLS, HumanSpeedTracker, PANEL_BG_SEQ, CONTENT_BG_SEQ, BOX_FG, TEXT_PRIMARY, TEXT_DIM, NO_SUB_AGENTS_HEADER_LABEL, HEADER_ACCENT_GREEN, HEADER_ACCENT_BOLD_FG, HEADER_BUTTON_BG, HEADER_BUTTON_FG, BOX_TL3, BOX_TR3, BOX_BL3, BOX_BR3, BOX_H3, BOX_V3, _globalFooterLock, RESET4, CURSOR_BLINK_BLOCK, _isWindows, SPONSOR_HEADER_LABEL_MAX, _termTitleWriter, StatusBar;
|
|
606742
606797
|
var init_status_bar = __esm({
|
|
606743
606798
|
"packages/cli/src/tui/status-bar.ts"() {
|
|
606744
606799
|
"use strict";
|
|
@@ -606933,6 +606988,7 @@ var init_status_bar = __esm({
|
|
|
606933
606988
|
CURSOR_BLINK_BLOCK = "\x1B[1 q";
|
|
606934
606989
|
_isWindows = process.platform === "win32";
|
|
606935
606990
|
SPONSOR_HEADER_LABEL_MAX = 48;
|
|
606991
|
+
_termTitleWriter = null;
|
|
606936
606992
|
StatusBar = class _StatusBar {
|
|
606937
606993
|
metrics = {
|
|
606938
606994
|
promptTokens: 0,
|
|
@@ -608325,12 +608381,14 @@ var init_status_bar = __esm({
|
|
|
608325
608381
|
this.renderFooterAndPositionInput();
|
|
608326
608382
|
this.refreshHeaderContent();
|
|
608327
608383
|
this.hookStdin();
|
|
608384
|
+
setTermTitleWriter((data) => this.writeChrome(data));
|
|
608328
608385
|
if (!this._metricsCollector.isActive) {
|
|
608329
608386
|
this.startLocalMetrics();
|
|
608330
608387
|
}
|
|
608331
608388
|
}
|
|
608332
608389
|
/** Deactivate — restore full-screen scroll region */
|
|
608333
608390
|
deactivate() {
|
|
608391
|
+
setTermTitleWriter(null);
|
|
608334
608392
|
this.active = false;
|
|
608335
608393
|
this._resizing = false;
|
|
608336
608394
|
if (this._resizeTimer) {
|
|
@@ -609365,7 +609423,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
609365
609423
|
removeRecentContentMatchingText(text2, maxRecentLines = 8) {
|
|
609366
609424
|
const firstLine = text2.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
609367
609425
|
if (!firstLine) return false;
|
|
609368
|
-
const normalize2 = (value2) => stripAnsi(value2).replace(/\s+/g, " ").trim().toLowerCase();
|
|
609426
|
+
const normalize2 = (value2) => stripAnsi(value2).replace(/^[│├└]\s*/, "").replace(/\s+/g, " ").trim().toLowerCase();
|
|
609369
609427
|
const needle = normalize2(firstLine);
|
|
609370
609428
|
if (needle.length < 12) return false;
|
|
609371
609429
|
const shortNeedle = needle.slice(0, Math.min(40, needle.length));
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.276",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.276",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
## Coding Conventions — Priority 5
|
|
2
|
+
|
|
3
|
+
These rules govern how you write, import, and verify code in this repository. They override any implicit assumptions about TypeScript/Node.js conventions. Violating them produces code the build rejects.
|
|
4
|
+
|
|
5
|
+
### ESM Import Extensions
|
|
6
|
+
|
|
7
|
+
ALWAYS use `.js` extension for relative imports. TypeScript with ESM (`"module": "NodeNext"`) requires file extensions in relative import paths. The compiled output is `.js`, so the import target is `.js`.
|
|
8
|
+
|
|
9
|
+
- ✅ `import { foo } from "./bar.js"`
|
|
10
|
+
- ❌ `import { foo } from "./bar"`
|
|
11
|
+
- ❌ `import { foo } from "./bar.ts"`
|
|
12
|
+
|
|
13
|
+
Exception: Package-name imports never need extensions:
|
|
14
|
+
|
|
15
|
+
- ✅ `import { foo } from "@omnius/memory"`
|
|
16
|
+
|
|
17
|
+
### Type Imports
|
|
18
|
+
|
|
19
|
+
When `verbatimModuleSyntax` is enabled (it is), types must use `import type`:
|
|
20
|
+
|
|
21
|
+
- ✅ `import type { Foo } from "./bar.js"`
|
|
22
|
+
- ✅ `import { type Foo, bar } from "./baz.js"`
|
|
23
|
+
- ❌ `import { Foo } from "./bar.js"` (Foo is type-only)
|
|
24
|
+
|
|
25
|
+
When in doubt, prefer a separate `import type` line.
|
|
26
|
+
|
|
27
|
+
### Cross-Package Imports
|
|
28
|
+
|
|
29
|
+
Use the package name, never a relative source path.
|
|
30
|
+
|
|
31
|
+
- ✅ `import { EpisodeStore } from "@omnius/memory"`
|
|
32
|
+
- ❌ `import { EpisodeStore } from "../../memory/src/store.js"`
|
|
33
|
+
|
|
34
|
+
Package names are defined in each workspace package's `package.json` `name` field. Known packages: `@omnius/core`, `@omnius/memory`, `@omnius/orchestrator`, `@omnius/execution`, `@omnius/cli`, `@omnius/integrations`.
|
|
35
|
+
|
|
36
|
+
### Build Verification
|
|
37
|
+
|
|
38
|
+
ALWAYS verify the build after modifying TypeScript files. Type errors that look subtle at write time are often caught by the compiler.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pnpm -r build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If errors appear, fix them before proceeding. Do not mark the task complete until `pnpm -r build` exits 0.
|
|
45
|
+
|
|
46
|
+
### Check Existing Conventions First
|
|
47
|
+
|
|
48
|
+
Before writing new code, check 2-3 existing files in the same directory for patterns:
|
|
49
|
+
|
|
50
|
+
- Import style (extensions, grouping, quoting)
|
|
51
|
+
- Function / class naming conventions
|
|
52
|
+
- Error handling patterns
|
|
53
|
+
- Export style (named vs default)
|
|
54
|
+
|
|
55
|
+
### Never Assume File Format
|
|
56
|
+
|
|
57
|
+
Do not guess a file's format from its extension alone. Check how existing code reads the file, or use `file <path>` to inspect it.
|
|
58
|
+
|
|
59
|
+
- `.db` files are SQLite, not JSON — use a SQLite library, not `JSON.parse`
|
|
60
|
+
- `.bin` files are binary
|
|
61
|
+
- `.json` files are JSON
|
|
62
|
+
|
|
63
|
+
### Wire New Commands Into the Dispatcher
|
|
64
|
+
|
|
65
|
+
New CLI slash commands require two things:
|
|
66
|
+
|
|
67
|
+
1. The handler file (e.g., `mem-metabolize.ts`)
|
|
68
|
+
2. Registration in the command dispatcher (`commands.ts`) — both a `case "name"` branch AND a `registerSlashCommand()` call
|
|
69
|
+
|
|
70
|
+
### Export New Modules From Package Index
|
|
71
|
+
|
|
72
|
+
Any new module added to a package must be re-exported from that package's `src/index.ts` so consumers can import it by package name.
|
|
73
|
+
|
|
74
|
+
### Create Type Dependencies First
|
|
75
|
+
|
|
76
|
+
If your code imports from a file you are creating (e.g., `./types`), create that file before writing the import — or at least in the same batch. A missing file causes a build failure invisible until you run the compiler.
|
|
77
|
+
|
|
78
|
+
### Type Annotations in Callbacks
|
|
79
|
+
|
|
80
|
+
Always provide explicit type parameters for generic array methods:
|
|
81
|
+
|
|
82
|
+
- ✅ `arr.sort((a: MyType, b: MyType) => a.order - b.order)`
|
|
83
|
+
- ✅ `arr.map((item: InputType): OutputType => transform(item))`
|
|
84
|
+
- ❌ `arr.sort((a, b) => a.order - b.order)`
|
|
85
|
+
|
|
86
|
+
### Read Before Editing
|
|
87
|
+
|
|
88
|
+
Always read a file with `file_read` before editing it with `file_edit` or `file_write`. Editing a file you have not read will lose any content between the version in your training data and the actual current file.
|