oh-my-opencode 5.1.70 → 5.1.72
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/cli/index.js +369 -123
- package/dist/cli/service-auth/protocol-request.d.ts +1 -0
- package/dist/cli/service-auth/protocol.d.ts +2 -2
- package/dist/cli-node/index.js +369 -123
- package/dist/features/team-mode/team-runtime/resolve-member-dependencies.d.ts +6 -3
- package/dist/hooks/legacy-plugin-toast/plugin-entry-migrator.d.ts +2 -1
- package/dist/index.js +1353 -1326
- package/dist/skills/browser/runtime/omowright/manifest.json +1 -1
- package/dist/tools/session-manager/constants.d.ts +1 -3
- package/dist/tui.js +30 -14
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +12 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
package/dist/cli-node/index.js
CHANGED
|
@@ -2133,7 +2133,7 @@ var package_default;
|
|
|
2133
2133
|
var init_package = __esm(() => {
|
|
2134
2134
|
package_default = {
|
|
2135
2135
|
name: "oh-my-opencode",
|
|
2136
|
-
version: "5.1.
|
|
2136
|
+
version: "5.1.72",
|
|
2137
2137
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2138
2138
|
main: "./dist/index.js",
|
|
2139
2139
|
types: "dist/index.d.ts",
|
|
@@ -2331,7 +2331,7 @@ var init_package = __esm(() => {
|
|
|
2331
2331
|
},
|
|
2332
2332
|
devDependencies: {
|
|
2333
2333
|
"@clack/prompts": "^1.8.1",
|
|
2334
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
2334
|
+
"@code-yeongyu/senpi": "2026.11.15-2",
|
|
2335
2335
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
2336
2336
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2337
2337
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
@@ -2404,18 +2404,18 @@ var init_package = __esm(() => {
|
|
|
2404
2404
|
typescript: "^7.0.2"
|
|
2405
2405
|
},
|
|
2406
2406
|
optionalDependencies: {
|
|
2407
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
2408
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
2409
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
2410
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
2411
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
2412
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
2413
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
2414
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
2415
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
2416
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
2417
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
2418
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
2407
|
+
"oh-my-opencode-darwin-arm64": "5.1.72",
|
|
2408
|
+
"oh-my-opencode-darwin-x64": "5.1.72",
|
|
2409
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.72",
|
|
2410
|
+
"oh-my-opencode-linux-arm64": "5.1.72",
|
|
2411
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.72",
|
|
2412
|
+
"oh-my-opencode-linux-x64": "5.1.72",
|
|
2413
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.72",
|
|
2414
|
+
"oh-my-opencode-linux-x64-musl": "5.1.72",
|
|
2415
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.72",
|
|
2416
|
+
"oh-my-opencode-windows-arm64": "5.1.72",
|
|
2417
|
+
"oh-my-opencode-windows-x64": "5.1.72",
|
|
2418
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.72"
|
|
2419
2419
|
},
|
|
2420
2420
|
overrides: {
|
|
2421
2421
|
hono: "^4.13.8",
|
|
@@ -77835,6 +77835,16 @@ var init_provenance = __esm(() => {
|
|
|
77835
77835
|
}).strict();
|
|
77836
77836
|
});
|
|
77837
77837
|
|
|
77838
|
+
// packages/omo-config-core/src/schema/session-wake.ts
|
|
77839
|
+
var OmoSessionWakeSettingsSchema;
|
|
77840
|
+
var init_session_wake = __esm(() => {
|
|
77841
|
+
init_zod();
|
|
77842
|
+
OmoSessionWakeSettingsSchema = object({
|
|
77843
|
+
same_device: boolean2().optional(),
|
|
77844
|
+
wake_limit: number2().int().min(0).optional()
|
|
77845
|
+
}).strict();
|
|
77846
|
+
});
|
|
77847
|
+
|
|
77838
77848
|
// packages/omo-config-core/src/schema/config.ts
|
|
77839
77849
|
var OmoOpenCodeHarnessConfigSchema, OmoDisabledSkillsSchema, OmoExcludedModelsSchema, OmoTypedHarnessConfigSchema, OmoConfigProfileSchema, OmoConfigSchema, OmoConfigLayerSchema;
|
|
77840
77850
|
var init_config = __esm(() => {
|
|
@@ -77854,11 +77864,13 @@ var init_config = __esm(() => {
|
|
|
77854
77864
|
init_device_service();
|
|
77855
77865
|
init_format_on_mutation();
|
|
77856
77866
|
init_provenance();
|
|
77867
|
+
init_session_wake();
|
|
77857
77868
|
OmoOpenCodeHarnessConfigSchema = record(string2(), unknown());
|
|
77858
77869
|
OmoDisabledSkillsSchema = array(string2());
|
|
77859
77870
|
OmoExcludedModelsSchema = array(string2());
|
|
77860
77871
|
OmoTypedHarnessConfigSchema = object({
|
|
77861
77872
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77873
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77862
77874
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77863
77875
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
77864
77876
|
agents: OmoAgentsConfigSchema.optional(),
|
|
@@ -77879,6 +77891,7 @@ var init_config = __esm(() => {
|
|
|
77879
77891
|
}).strict();
|
|
77880
77892
|
OmoConfigProfileSchema = object({
|
|
77881
77893
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77894
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77882
77895
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77883
77896
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
77884
77897
|
agents: OmoAgentsConfigSchema.optional(),
|
|
@@ -77903,6 +77916,7 @@ var init_config = __esm(() => {
|
|
|
77903
77916
|
}).strict();
|
|
77904
77917
|
OmoConfigSchema = object({
|
|
77905
77918
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77919
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77906
77920
|
formatOnMutation: OmoFormatOnMutationSchema.optional(),
|
|
77907
77921
|
$schema: string2().optional(),
|
|
77908
77922
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -77931,6 +77945,7 @@ var init_config = __esm(() => {
|
|
|
77931
77945
|
}).strict();
|
|
77932
77946
|
OmoConfigLayerSchema = object({
|
|
77933
77947
|
provenance: OmoProvenanceSettingsSchema.optional(),
|
|
77948
|
+
session_wake: OmoSessionWakeSettingsSchema.optional(),
|
|
77934
77949
|
formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
|
|
77935
77950
|
$schema: string2().optional(),
|
|
77936
77951
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -78092,6 +78107,7 @@ var init_schema = __esm(() => {
|
|
|
78092
78107
|
init_model_profile();
|
|
78093
78108
|
init_model_ref();
|
|
78094
78109
|
init_provenance();
|
|
78110
|
+
init_session_wake();
|
|
78095
78111
|
init_side_panel();
|
|
78096
78112
|
init_task();
|
|
78097
78113
|
init_team();
|
|
@@ -92940,7 +92956,7 @@ var package_default2;
|
|
|
92940
92956
|
var init_package2 = __esm(() => {
|
|
92941
92957
|
package_default2 = {
|
|
92942
92958
|
name: "@oh-my-opencode/omo-codex",
|
|
92943
|
-
version: "5.1.
|
|
92959
|
+
version: "5.1.72",
|
|
92944
92960
|
type: "module",
|
|
92945
92961
|
private: true,
|
|
92946
92962
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -100331,6 +100347,7 @@ var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
|
100331
100347
|
join66("extensions", "loro_wasm_bg.wasm"),
|
|
100332
100348
|
join66("extensions", "CaseFolding.txt"),
|
|
100333
100349
|
join66("extensions", "omo-thread-client.js"),
|
|
100350
|
+
join66("extensions", "omo-wake.js"),
|
|
100334
100351
|
join66("extensions", "omo-telemetry-recovery.js"),
|
|
100335
100352
|
join66("extensions", "omo-feedback.js"),
|
|
100336
100353
|
join66("extensions", "omo-desktop-toolkit.js"),
|
|
@@ -109727,14 +109744,15 @@ var package_default3 = {
|
|
|
109727
109744
|
},
|
|
109728
109745
|
dependencies: {
|
|
109729
109746
|
"@clack/prompts": "^1.8.1",
|
|
109730
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
109731
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.
|
|
109747
|
+
"@code-yeongyu/senpi": "2026.11.15-2",
|
|
109748
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.15-2",
|
|
109732
109749
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
109733
109750
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
109734
109751
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
109735
109752
|
"@oh-my-opencode/claude-code-compat-core": "workspace:*",
|
|
109736
109753
|
"@oh-my-opencode/comment-checker-core": "workspace:*",
|
|
109737
109754
|
"@oh-my-opencode/delegate-core": "workspace:*",
|
|
109755
|
+
"@oh-my-opencode/device-service-core": "workspace:*",
|
|
109738
109756
|
"@oh-my-opencode/hashline-core": "workspace:*",
|
|
109739
109757
|
"@oh-my-opencode/mcp-client-core": "workspace:*",
|
|
109740
109758
|
"@oh-my-opencode/model-core": "workspace:*",
|
|
@@ -112753,14 +112771,6 @@ class RequestFailure extends SignInError {
|
|
|
112753
112771
|
this.responseStatus = responseStatus;
|
|
112754
112772
|
}
|
|
112755
112773
|
}
|
|
112756
|
-
|
|
112757
|
-
class InvalidApiResponse extends SignInError {
|
|
112758
|
-
status;
|
|
112759
|
-
constructor(status) {
|
|
112760
|
-
super("The service returned an invalid error response.");
|
|
112761
|
-
this.status = status;
|
|
112762
|
-
}
|
|
112763
|
-
}
|
|
112764
112774
|
var platformSchema = _enum(["macos", "linux", "windows"]);
|
|
112765
112775
|
var nonempty = string2().min(1);
|
|
112766
112776
|
var timestamp = string2().datetime({ offset: true });
|
|
@@ -112792,15 +112802,6 @@ var deviceCodeSchema = object({
|
|
|
112792
112802
|
expiresAt: timestamp,
|
|
112793
112803
|
intervalSeconds: number2().int().min(1).max(60)
|
|
112794
112804
|
});
|
|
112795
|
-
var envelopeSchema = object({
|
|
112796
|
-
error: object({
|
|
112797
|
-
code: nonempty,
|
|
112798
|
-
message: string2(),
|
|
112799
|
-
retryable: boolean2(),
|
|
112800
|
-
requestId: string2(),
|
|
112801
|
-
detail: unknown().optional()
|
|
112802
|
-
})
|
|
112803
|
-
});
|
|
112804
112805
|
var limitSchema = object({
|
|
112805
112806
|
reason: literal("device_limit"),
|
|
112806
112807
|
managementToken: nonempty,
|
|
@@ -112937,59 +112938,6 @@ function serviceOrigin(value) {
|
|
|
112937
112938
|
}
|
|
112938
112939
|
return url.origin;
|
|
112939
112940
|
}
|
|
112940
|
-
async function requestApi(api, path, init, signal) {
|
|
112941
|
-
let response;
|
|
112942
|
-
let body;
|
|
112943
|
-
try {
|
|
112944
|
-
response = await fetch(`${api}${path}`, {
|
|
112945
|
-
...init,
|
|
112946
|
-
redirect: "error",
|
|
112947
|
-
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000)
|
|
112948
|
-
});
|
|
112949
|
-
} catch (error) {
|
|
112950
|
-
const cause = error instanceof Error && error.cause instanceof Error ? error.cause : error;
|
|
112951
|
-
const code = cause instanceof Error ? Reflect.get(cause, "code") : undefined;
|
|
112952
|
-
throw new RequestFailure(typeof code === "string" && [
|
|
112953
|
-
"ENOTFOUND",
|
|
112954
|
-
"ECONNREFUSED",
|
|
112955
|
-
"ENETUNREACH",
|
|
112956
|
-
"EHOSTUNREACH",
|
|
112957
|
-
"EAI_AGAIN",
|
|
112958
|
-
"ConnectionRefused",
|
|
112959
|
-
"EADDRNOTAVAIL",
|
|
112960
|
-
"ENETDOWN",
|
|
112961
|
-
"EHOSTDOWN",
|
|
112962
|
-
"UND_ERR_CONNECT_TIMEOUT",
|
|
112963
|
-
"ERR_TLS_HANDSHAKE_TIMEOUT",
|
|
112964
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
112965
|
-
"CERT_HAS_EXPIRED",
|
|
112966
|
-
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
112967
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
112968
|
-
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
112969
|
-
"CERT_NOT_YET_VALID",
|
|
112970
|
-
"UNABLE_TO_GET_ISSUER_CERT",
|
|
112971
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
112972
|
-
"CERT_SIGNATURE_FAILURE",
|
|
112973
|
-
"CERT_UNTRUSTED",
|
|
112974
|
-
"CERT_REJECTED"
|
|
112975
|
-
].includes(code));
|
|
112976
|
-
}
|
|
112977
|
-
if (response.status === 204)
|
|
112978
|
-
return null;
|
|
112979
|
-
try {
|
|
112980
|
-
body = await response.json();
|
|
112981
|
-
} catch {
|
|
112982
|
-
throw new RequestFailure(false, response.status);
|
|
112983
|
-
}
|
|
112984
|
-
if (response.ok)
|
|
112985
|
-
return body;
|
|
112986
|
-
const envelope = envelopeSchema.safeParse(body);
|
|
112987
|
-
if (!envelope.success)
|
|
112988
|
-
throw new InvalidApiResponse(response.status);
|
|
112989
|
-
const error = envelope.data.error;
|
|
112990
|
-
const detail = limitSchema.safeParse(error.detail);
|
|
112991
|
-
throw new ApiRefusal(error.code, response.status, error.code === "entitlement_required" && detail.success ? detail.data : undefined, response.headers.get("retry-after"));
|
|
112992
|
-
}
|
|
112993
112941
|
var jsonRequest = (body) => ({
|
|
112994
112942
|
method: "POST",
|
|
112995
112943
|
headers: { "content-type": "application/json" },
|
|
@@ -115442,6 +115390,100 @@ ${key.name}`;
|
|
|
115442
115390
|
// packages/omo-opencode/src/cli/service-auth/session.ts
|
|
115443
115391
|
import { homedir as homedir34 } from "node:os";
|
|
115444
115392
|
|
|
115393
|
+
// packages/device-service-core/src/local-only.ts
|
|
115394
|
+
var KEY2 = Symbol.for("omo.local-only-process.v1");
|
|
115395
|
+
function state3() {
|
|
115396
|
+
const holder = globalThis;
|
|
115397
|
+
holder[KEY2] ??= { marked: false };
|
|
115398
|
+
return holder[KEY2];
|
|
115399
|
+
}
|
|
115400
|
+
|
|
115401
|
+
class LocalOnlyNetworkRefused extends Error {
|
|
115402
|
+
code = "local_only_network_refused";
|
|
115403
|
+
site;
|
|
115404
|
+
constructor(site) {
|
|
115405
|
+
super(`a local-only omo remote command reached the network at ${site}`);
|
|
115406
|
+
this.site = site;
|
|
115407
|
+
}
|
|
115408
|
+
}
|
|
115409
|
+
function refuseIfLocalOnly(site) {
|
|
115410
|
+
if (state3().marked)
|
|
115411
|
+
throw new LocalOnlyNetworkRefused(site);
|
|
115412
|
+
}
|
|
115413
|
+
|
|
115414
|
+
// packages/omo-opencode/src/cli/service-auth/protocol-request.ts
|
|
115415
|
+
init_zod();
|
|
115416
|
+
class InvalidApiResponse extends SignInError {
|
|
115417
|
+
status;
|
|
115418
|
+
constructor(status) {
|
|
115419
|
+
super("The service returned an invalid error response.");
|
|
115420
|
+
this.status = status;
|
|
115421
|
+
}
|
|
115422
|
+
}
|
|
115423
|
+
var envelopeSchema = object({
|
|
115424
|
+
error: object({
|
|
115425
|
+
code: nonempty,
|
|
115426
|
+
message: string2(),
|
|
115427
|
+
retryable: boolean2(),
|
|
115428
|
+
requestId: string2(),
|
|
115429
|
+
detail: unknown().optional()
|
|
115430
|
+
})
|
|
115431
|
+
});
|
|
115432
|
+
async function requestApi(api, path, init, signal) {
|
|
115433
|
+
refuseIfLocalOnly("service-auth/protocol-request.ts requestApi");
|
|
115434
|
+
let response;
|
|
115435
|
+
let body;
|
|
115436
|
+
try {
|
|
115437
|
+
response = await fetch(`${api}${path}`, {
|
|
115438
|
+
...init,
|
|
115439
|
+
redirect: "error",
|
|
115440
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000)
|
|
115441
|
+
});
|
|
115442
|
+
} catch (error) {
|
|
115443
|
+
const cause = error instanceof Error && error.cause instanceof Error ? error.cause : error;
|
|
115444
|
+
const code = cause instanceof Error ? Reflect.get(cause, "code") : undefined;
|
|
115445
|
+
throw new RequestFailure(typeof code === "string" && [
|
|
115446
|
+
"ENOTFOUND",
|
|
115447
|
+
"ECONNREFUSED",
|
|
115448
|
+
"ENETUNREACH",
|
|
115449
|
+
"EHOSTUNREACH",
|
|
115450
|
+
"EAI_AGAIN",
|
|
115451
|
+
"ConnectionRefused",
|
|
115452
|
+
"EADDRNOTAVAIL",
|
|
115453
|
+
"ENETDOWN",
|
|
115454
|
+
"EHOSTDOWN",
|
|
115455
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
115456
|
+
"ERR_TLS_HANDSHAKE_TIMEOUT",
|
|
115457
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
115458
|
+
"CERT_HAS_EXPIRED",
|
|
115459
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
115460
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
115461
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
115462
|
+
"CERT_NOT_YET_VALID",
|
|
115463
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
115464
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
115465
|
+
"CERT_SIGNATURE_FAILURE",
|
|
115466
|
+
"CERT_UNTRUSTED",
|
|
115467
|
+
"CERT_REJECTED"
|
|
115468
|
+
].includes(code));
|
|
115469
|
+
}
|
|
115470
|
+
if (response.status === 204)
|
|
115471
|
+
return null;
|
|
115472
|
+
try {
|
|
115473
|
+
body = await response.json();
|
|
115474
|
+
} catch {
|
|
115475
|
+
throw new RequestFailure(false, response.status);
|
|
115476
|
+
}
|
|
115477
|
+
if (response.ok)
|
|
115478
|
+
return body;
|
|
115479
|
+
const envelope = envelopeSchema.safeParse(body);
|
|
115480
|
+
if (!envelope.success)
|
|
115481
|
+
throw new InvalidApiResponse(response.status);
|
|
115482
|
+
const error = envelope.data.error;
|
|
115483
|
+
const detail = limitSchema.safeParse(error.detail);
|
|
115484
|
+
throw new ApiRefusal(error.code, response.status, error.code === "entitlement_required" && detail.success ? detail.data : undefined, response.headers.get("retry-after"));
|
|
115485
|
+
}
|
|
115486
|
+
|
|
115445
115487
|
// packages/omo-opencode/src/cli/service-auth/signed-out-marker.ts
|
|
115446
115488
|
init_zod();
|
|
115447
115489
|
import { mkdir as mkdir13, readFile as readFile38, rename as rename10, rm as rm19, writeFile as writeFile18 } from "node:fs/promises";
|
|
@@ -115516,6 +115558,7 @@ function createSession(options) {
|
|
|
115516
115558
|
}
|
|
115517
115559
|
if (Date.parse(current.accessTokenExpiresAt) > now() + 30000)
|
|
115518
115560
|
return current;
|
|
115561
|
+
refuseIfLocalOnly("service-auth/session.ts refresh");
|
|
115519
115562
|
await store.write({ ...current, refreshState: "uncertain" });
|
|
115520
115563
|
try {
|
|
115521
115564
|
const tokens = parseReply(tokenSchema, await request("/v1/session/refresh", jsonRequest({ refreshToken: current.refreshToken })));
|
|
@@ -116087,8 +116130,7 @@ function configureServiceAuthCommands(program, open = serviceAccountsOpen(), hoo
|
|
|
116087
116130
|
import { existsSync as existsSync68 } from "node:fs";
|
|
116088
116131
|
|
|
116089
116132
|
// packages/device-service-core/src/device-service.ts
|
|
116090
|
-
import {
|
|
116091
|
-
import { join as join120 } from "node:path";
|
|
116133
|
+
import { join as join121 } from "node:path";
|
|
116092
116134
|
|
|
116093
116135
|
// packages/device-service-core/src/local-api/access.ts
|
|
116094
116136
|
import { createHmac as createHmac2, randomBytes as randomBytes7, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
@@ -116597,7 +116639,8 @@ var ERROR_CODES = [
|
|
|
116597
116639
|
"method_unclassified",
|
|
116598
116640
|
"method_local_only",
|
|
116599
116641
|
"host_not_answering",
|
|
116600
|
-
"unsupported"
|
|
116642
|
+
"unsupported",
|
|
116643
|
+
"unknown_delivery"
|
|
116601
116644
|
];
|
|
116602
116645
|
var PATH_REFUSAL_PROBLEMS = [
|
|
116603
116646
|
"not_absolute",
|
|
@@ -116861,6 +116904,7 @@ var ATTACH_ID_MAX = 4294967295;
|
|
|
116861
116904
|
var MILLIS_MAX = Number.MAX_SAFE_INTEGER;
|
|
116862
116905
|
var deviceId = (v, what = "device") => text(v, SESSION_DEVICE_MAX_CHARS, what);
|
|
116863
116906
|
var sessionId = (v) => text(v, SESSION_ID_MAX_CHARS, "session_id");
|
|
116907
|
+
var durableId = (v, what = "durable_id") => text(v, SESSION_ID_MAX_CHARS, what);
|
|
116864
116908
|
var attachId = (v) => uint(v, 1, ATTACH_ID_MAX, "attach_id");
|
|
116865
116909
|
var millis = (v, what) => uint(v, 0, MILLIS_MAX, what);
|
|
116866
116910
|
var deviceRef = (v, what = "device", fields = exactly) => {
|
|
@@ -117293,6 +117337,94 @@ var DELEGATED_EVENT_VALIDATORS = {
|
|
|
117293
117337
|
}
|
|
117294
117338
|
};
|
|
117295
117339
|
|
|
117340
|
+
// packages/device-service-core/src/local-api/validate-deliveries.ts
|
|
117341
|
+
var PROTOCOL_MAX = 1e6;
|
|
117342
|
+
var PAIRS_MAX = 4096;
|
|
117343
|
+
var pairOf = (m) => ({
|
|
117344
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117345
|
+
session_id: durableId(m["session_id"], "session_id"),
|
|
117346
|
+
last_command_id: commandId(m["last_command_id"])
|
|
117347
|
+
});
|
|
117348
|
+
var PAIR_FIELDS = ["sender_device", "session_id", "last_command_id"];
|
|
117349
|
+
var DELIVERIES_REQUEST_VALIDATORS = {
|
|
117350
|
+
"delivery.pending": (v, id) => {
|
|
117351
|
+
const pairs = requestFields(v, ["pairs"])["pairs"];
|
|
117352
|
+
if (!Array.isArray(pairs) || pairs.length > PAIRS_MAX)
|
|
117353
|
+
return fail("pairs");
|
|
117354
|
+
return { id, type: "delivery.pending", pairs: pairs.map((p) => pairOf(exactly(p, PAIR_FIELDS, [], "pair"))) };
|
|
117355
|
+
},
|
|
117356
|
+
"delivery.drained": (v, id) => ({ id, type: "delivery.drained", ...pairOf(requestFields(v, PAIR_FIELDS)) }),
|
|
117357
|
+
"deliveries.serve": (v, id) => {
|
|
117358
|
+
const m = requestFields(v, ["agent_dir", "v"]);
|
|
117359
|
+
return {
|
|
117360
|
+
id,
|
|
117361
|
+
type: "deliveries.serve",
|
|
117362
|
+
agent_dir: absolutePath(m["agent_dir"], "agent_dir"),
|
|
117363
|
+
v: uint(m["v"], 0, PROTOCOL_MAX, "v")
|
|
117364
|
+
};
|
|
117365
|
+
},
|
|
117366
|
+
"delivery.answer": (v, id) => {
|
|
117367
|
+
const m = requestFields(v, ["sender_device", "command_id", "reply"]);
|
|
117368
|
+
return {
|
|
117369
|
+
id,
|
|
117370
|
+
type: "delivery.answer",
|
|
117371
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117372
|
+
command_id: commandId(m["command_id"]),
|
|
117373
|
+
reply: jsonObject(m["reply"], "reply")
|
|
117374
|
+
};
|
|
117375
|
+
},
|
|
117376
|
+
"delivery.held": (v, id) => {
|
|
117377
|
+
const m = requestFields(v, ["ask_id", "holds"]);
|
|
117378
|
+
return { id, type: "delivery.held", ask_id: localId(m["ask_id"], "ask_id"), holds: bool(m["holds"], "holds") };
|
|
117379
|
+
},
|
|
117380
|
+
"peer.admitted": (v, id) => ({ id, type: "peer.admitted", device: deviceId(requestFields(v, ["device"])["device"]) })
|
|
117381
|
+
};
|
|
117382
|
+
var empty = (v) => {
|
|
117383
|
+
known(v, [], [], "data");
|
|
117384
|
+
return {};
|
|
117385
|
+
};
|
|
117386
|
+
var DELIVERIES_DATA = {
|
|
117387
|
+
"deliveries.serve": (v) => ({ wake: bool(known(v, ["wake"], [], "data")["wake"], "wake") }),
|
|
117388
|
+
"delivery.answer": empty,
|
|
117389
|
+
"delivery.held": empty,
|
|
117390
|
+
"delivery.pending": empty,
|
|
117391
|
+
"delivery.drained": (v) => {
|
|
117392
|
+
const m = known(v, ["kept"], ["expecting"], "data");
|
|
117393
|
+
const kept = bool(m["kept"], "kept");
|
|
117394
|
+
if (!kept)
|
|
117395
|
+
return m["expecting"] === undefined ? { kept } : fail("expecting");
|
|
117396
|
+
return { kept, expecting: commandId(m["expecting"]) };
|
|
117397
|
+
},
|
|
117398
|
+
"peer.admitted": (v) => ({ admitted: bool(known(v, ["admitted"], [], "data")["admitted"], "admitted") })
|
|
117399
|
+
};
|
|
117400
|
+
var DELIVERIES_EVENT_VALIDATORS = {
|
|
117401
|
+
"delivery.wake": (v) => ({
|
|
117402
|
+
type: "event",
|
|
117403
|
+
kind: "delivery.wake",
|
|
117404
|
+
enabled: bool(eventFields(v, ["enabled"])["enabled"], "enabled")
|
|
117405
|
+
}),
|
|
117406
|
+
"delivery.inbound": (v) => {
|
|
117407
|
+
const m = eventFields(v, ["command_id", "sender_device", "durable_id", "record"]);
|
|
117408
|
+
return {
|
|
117409
|
+
type: "event",
|
|
117410
|
+
kind: "delivery.inbound",
|
|
117411
|
+
command_id: commandId(m["command_id"]),
|
|
117412
|
+
sender_device: deviceId(m["sender_device"], "sender_device"),
|
|
117413
|
+
durable_id: durableId(m["durable_id"]),
|
|
117414
|
+
record: jsonObject(m["record"], "record")
|
|
117415
|
+
};
|
|
117416
|
+
},
|
|
117417
|
+
"delivery.holds": (v) => {
|
|
117418
|
+
const m = eventFields(v, ["ask_id", "durable_id"]);
|
|
117419
|
+
return {
|
|
117420
|
+
type: "event",
|
|
117421
|
+
kind: "delivery.holds",
|
|
117422
|
+
ask_id: localId(m["ask_id"], "ask_id"),
|
|
117423
|
+
durable_id: durableId(m["durable_id"])
|
|
117424
|
+
};
|
|
117425
|
+
}
|
|
117426
|
+
};
|
|
117427
|
+
|
|
117296
117428
|
// packages/device-service-core/src/local-api/validate-events.ts
|
|
117297
117429
|
var revisionOf = (m) => uint(m["revision"], 1, Number.MAX_SAFE_INTEGER, "revision");
|
|
117298
117430
|
var devicesOf = (v) => {
|
|
@@ -117344,6 +117476,7 @@ var commandStateOf = (v) => {
|
|
|
117344
117476
|
var VALIDATORS = {
|
|
117345
117477
|
...STREAM_EVENT_VALIDATORS,
|
|
117346
117478
|
...DELEGATED_EVENT_VALIDATORS,
|
|
117479
|
+
...DELIVERIES_EVENT_VALIDATORS,
|
|
117347
117480
|
"status.changed": (v) => ({
|
|
117348
117481
|
type: "event",
|
|
117349
117482
|
kind: "status.changed",
|
|
@@ -117474,6 +117607,7 @@ var agentDir = (v) => absolutePath(requestFields(v, ["agent_dir"])["agent_dir"],
|
|
|
117474
117607
|
var VALIDATORS2 = {
|
|
117475
117608
|
...COMMAND_REQUEST_VALIDATORS,
|
|
117476
117609
|
...DELEGATED_REQUEST_VALIDATORS,
|
|
117610
|
+
...DELIVERIES_REQUEST_VALIDATORS,
|
|
117477
117611
|
authenticate: (v, id) => {
|
|
117478
117612
|
const m = requestFields(v, ["client_proof"]);
|
|
117479
117613
|
return { id, type: "authenticate", client_proof: text(m["client_proof"], 64, "client_proof") };
|
|
@@ -117486,6 +117620,15 @@ var VALIDATORS2 = {
|
|
|
117486
117620
|
bare(v);
|
|
117487
117621
|
return { id, type: "status.subscribe" };
|
|
117488
117622
|
},
|
|
117623
|
+
"control.session_wake.get": (v, id) => {
|
|
117624
|
+
bare(v);
|
|
117625
|
+
return { id, type: "control.session_wake.get" };
|
|
117626
|
+
},
|
|
117627
|
+
"control.session_wake.set": (v, id) => {
|
|
117628
|
+
const value = requestFields(v, ["enabled"])["enabled"];
|
|
117629
|
+
const enabled = value === null || typeof value === "boolean" ? value : fail("enabled");
|
|
117630
|
+
return { id, type: "control.session_wake.set", enabled };
|
|
117631
|
+
},
|
|
117489
117632
|
"control.attach.get": (v, id) => {
|
|
117490
117633
|
bare(v);
|
|
117491
117634
|
return { id, type: "control.attach.get" };
|
|
@@ -117622,7 +117765,7 @@ var validateWelcome = (v) => asViolation(() => {
|
|
|
117622
117765
|
state: statusOf(m["state"])
|
|
117623
117766
|
};
|
|
117624
117767
|
});
|
|
117625
|
-
var
|
|
117768
|
+
var empty2 = (v) => {
|
|
117626
117769
|
known(v, [], [], "data");
|
|
117627
117770
|
return {};
|
|
117628
117771
|
};
|
|
@@ -117635,35 +117778,49 @@ var attachState = (v) => {
|
|
|
117635
117778
|
changedAt: typeof changedAt === "string" ? changedAt : fail("changedAt")
|
|
117636
117779
|
};
|
|
117637
117780
|
};
|
|
117781
|
+
var sessionWakeState = (v) => {
|
|
117782
|
+
const m = known(v, ["enabled", "stored", "changedAt", "overridden"], [], "data");
|
|
117783
|
+
const s = m["stored"];
|
|
117784
|
+
const changedAt = m["changedAt"];
|
|
117785
|
+
return {
|
|
117786
|
+
enabled: bool(m["enabled"], "enabled"),
|
|
117787
|
+
stored: s === null || typeof s === "boolean" ? s : s === "unreadable" ? "unreadable" : fail("stored"),
|
|
117788
|
+
changedAt: typeof changedAt === "string" ? changedAt : fail("changedAt"),
|
|
117789
|
+
overridden: bool(m["overridden"], "overridden")
|
|
117790
|
+
};
|
|
117791
|
+
};
|
|
117638
117792
|
var DATA = {
|
|
117639
|
-
authenticate:
|
|
117793
|
+
authenticate: empty2,
|
|
117640
117794
|
"status.get": statusOf,
|
|
117641
|
-
"status.subscribe":
|
|
117795
|
+
"status.subscribe": empty2,
|
|
117642
117796
|
"service.set_enabled": (v) => ({ enabled: bool(one(v, "enabled"), "enabled") }),
|
|
117643
|
-
"refresher.register":
|
|
117797
|
+
"refresher.register": empty2,
|
|
117644
117798
|
"device.adopt": (v) => ({ device: deviceRef(one(v, "device"), "device", known) }),
|
|
117645
|
-
"device.forget":
|
|
117799
|
+
"device.forget": empty2,
|
|
117646
117800
|
"device.info": (v) => ({
|
|
117647
117801
|
device: nullable2(one(v, "device"), (d) => deviceRef(d, "device", known))
|
|
117648
117802
|
}),
|
|
117649
|
-
"endpoints.register":
|
|
117650
|
-
"endpoints.unregister":
|
|
117803
|
+
"endpoints.register": empty2,
|
|
117804
|
+
"endpoints.unregister": empty2,
|
|
117651
117805
|
"devices.list": (v) => {
|
|
117652
117806
|
const devices = one(v, "devices");
|
|
117653
117807
|
return Array.isArray(devices) ? { devices: devices.map(deviceRowOf) } : fail("devices");
|
|
117654
117808
|
},
|
|
117655
117809
|
"sessions.list": (v) => ({ query_id: localId(one(v, "query_id"), "query_id") }),
|
|
117656
117810
|
"session.attach": (v) => ({ attach: localId(one(v, "attach"), "attach") }),
|
|
117657
|
-
"session.detach":
|
|
117811
|
+
"session.detach": empty2,
|
|
117658
117812
|
"session.command": (v) => ({ command_id: commandId(one(v, "command_id")) }),
|
|
117659
117813
|
"session.command_part": (v) => ({
|
|
117660
117814
|
received: uint(one(v, "received"), 0, LOCAL_UPLOAD_PARTS_MAX - 1, "received")
|
|
117661
117815
|
}),
|
|
117662
117816
|
"session.read": (v) => ({ query_id: localId(one(v, "query_id"), "query_id") }),
|
|
117663
|
-
"enforcement.report":
|
|
117664
|
-
"owner.shutdown_for_upgrade":
|
|
117817
|
+
"enforcement.report": empty2,
|
|
117818
|
+
"owner.shutdown_for_upgrade": empty2,
|
|
117665
117819
|
"session.endpoints": endpointsData,
|
|
117666
117820
|
"session.locate": locateData,
|
|
117821
|
+
...DELIVERIES_DATA,
|
|
117822
|
+
"control.session_wake.get": sessionWakeState,
|
|
117823
|
+
"control.session_wake.set": sessionWakeState,
|
|
117667
117824
|
"control.attach.get": attachState,
|
|
117668
117825
|
"control.attach.set": attachState
|
|
117669
117826
|
};
|
|
@@ -117752,6 +117909,9 @@ class EventAssembler {
|
|
|
117752
117909
|
case "session.command_blob_chunk":
|
|
117753
117910
|
case "session.command_blob_done":
|
|
117754
117911
|
case "session.channel_closed":
|
|
117912
|
+
case "delivery.inbound":
|
|
117913
|
+
case "delivery.holds":
|
|
117914
|
+
case "delivery.wake":
|
|
117755
117915
|
return;
|
|
117756
117916
|
default:
|
|
117757
117917
|
return assertNever(event);
|
|
@@ -118177,7 +118337,8 @@ var handshake = (connection, options) => new Promise((resolve, reject) => {
|
|
|
118177
118337
|
}, HANDSHAKE_TIMEOUT_MS);
|
|
118178
118338
|
proveAndAuthenticate(connection, options).then(resolve, reject).finally(cancel);
|
|
118179
118339
|
});
|
|
118180
|
-
var sendCommand = async (connection, attach, rpc, command_id, route) => {
|
|
118340
|
+
var sendCommand = async (connection, attach, rpc, command_id, route, accepts) => {
|
|
118341
|
+
const marked = accepts === undefined ? {} : { accepts };
|
|
118181
118342
|
const sent = command_id ?? mintId();
|
|
118182
118343
|
const id = { command_id: sent };
|
|
118183
118344
|
const timedOut = (error) => {
|
|
@@ -118204,9 +118365,26 @@ var sendCommand = async (connection, attach, rpc, command_id, route) => {
|
|
|
118204
118365
|
const upload_id = mintId();
|
|
118205
118366
|
const parts = uploadParts(json).map((part) => connection.request("session.command_part", { attach, upload_id, ...part }));
|
|
118206
118367
|
await Promise.all(parts);
|
|
118207
|
-
return (await connection.request("session.command", { attach, ...id, ...route, upload_id }).catch(timedOut)).command_id;
|
|
118368
|
+
return (await connection.request("session.command", { attach, ...id, ...marked, ...route, upload_id }).catch(timedOut)).command_id;
|
|
118369
|
+
}
|
|
118370
|
+
return (await connection.request("session.command", { attach, ...id, ...marked, ...route, rpc }).catch(timedOut)).command_id;
|
|
118371
|
+
};
|
|
118372
|
+
var sendWakeCommand = async (connection, device, durableId, rpc, command_id) => {
|
|
118373
|
+
const sent = command_id ?? mintId();
|
|
118374
|
+
const params = { wake: { device, durable_id: durableId }, command_id: sent, rpc };
|
|
118375
|
+
if (lineBytes({ id: "x".repeat(REQUEST_ID_MAX_CHARS), type: "session.command", ...params }) > LOCAL_INLINE_MAX)
|
|
118376
|
+
throw new LocalApiError("message_too_long", "a wake command travels inline only", {
|
|
118377
|
+
limit_chars: MESSAGE_LIMIT_CHARS
|
|
118378
|
+
});
|
|
118379
|
+
try {
|
|
118380
|
+
return (await connection.request("session.command", params)).command_id;
|
|
118381
|
+
} catch (error) {
|
|
118382
|
+
if (error instanceof LocalApiError && error.code === "request_timeout")
|
|
118383
|
+
throw new LocalApiError("request_timeout", `command ${sent} may have been dispatched; follow its command state`, {
|
|
118384
|
+
command_id: sent
|
|
118385
|
+
});
|
|
118386
|
+
throw error;
|
|
118208
118387
|
}
|
|
118209
|
-
return (await connection.request("session.command", { attach, ...id, ...route, rpc }).catch(timedOut)).command_id;
|
|
118210
118388
|
};
|
|
118211
118389
|
var sendEndpointCommand = async (connection, device, endpoint, rpc, command_id, locate) => {
|
|
118212
118390
|
const sent = command_id ?? mintId();
|
|
@@ -118249,7 +118427,8 @@ var connectLocalApi = async (options) => {
|
|
|
118249
118427
|
listeners.delete(listener);
|
|
118250
118428
|
};
|
|
118251
118429
|
},
|
|
118252
|
-
command: (attach, rpc, command_id, route = {}) => sendCommand(connection, attach, rpc, command_id, route),
|
|
118430
|
+
command: (attach, rpc, command_id, route = {}, options) => sendCommand(connection, attach, rpc, command_id, route, options?.accepts),
|
|
118431
|
+
wakeCommand: (device, durableId, rpc, command_id) => sendWakeCommand(connection, device, durableId, rpc, command_id),
|
|
118253
118432
|
endpointCommand: (device, endpoint, rpc, command_id, options) => sendEndpointCommand(connection, device, endpoint, rpc, command_id, options?.locate === true),
|
|
118254
118433
|
list: (filter, onRevision, rows) => new Promise((resolve, reject) => {
|
|
118255
118434
|
const params = {
|
|
@@ -118518,7 +118697,7 @@ function openAttach(client, device, sessionId) {
|
|
|
118518
118697
|
failure: () => failure,
|
|
118519
118698
|
onFrame: (listener) => delegated.onFrame(listener),
|
|
118520
118699
|
onChannelLoss: (listener) => delegated.onLoss(listener),
|
|
118521
|
-
command: (rpc) => new Promise((resolve, reject) => {
|
|
118700
|
+
command: (rpc, options) => new Promise((resolve, reject) => {
|
|
118522
118701
|
if (ended)
|
|
118523
118702
|
return reject(new Error("the attach has ended"));
|
|
118524
118703
|
const commandId = randomBytes8(16).toString("base64url");
|
|
@@ -118542,7 +118721,7 @@ function openAttach(client, device, sessionId) {
|
|
|
118542
118721
|
resolve(response === undefined ? { outcome: event } : { outcome: event, response });
|
|
118543
118722
|
});
|
|
118544
118723
|
commands.add(end);
|
|
118545
|
-
client.command(attach, rpc, commandId, { delegated: true }).catch((error) => {
|
|
118724
|
+
client.command(attach, rpc, commandId, { delegated: true }, options).catch((error) => {
|
|
118546
118725
|
settle();
|
|
118547
118726
|
reject(error);
|
|
118548
118727
|
});
|
|
@@ -118586,6 +118765,9 @@ function newestRowsListing(client) {
|
|
|
118586
118765
|
// packages/device-service-core/src/device-service.ts
|
|
118587
118766
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
118588
118767
|
|
|
118768
|
+
// packages/device-service-core/src/minimum-in-effect.ts
|
|
118769
|
+
var minimumInEffect = (option, key, shipped) => option === undefined ? shipped : option[key];
|
|
118770
|
+
|
|
118589
118771
|
// packages/device-service-core/src/release/version.ts
|
|
118590
118772
|
var SEMVER2 = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
118591
118773
|
var compareIdentifier = (a, b) => {
|
|
@@ -118622,9 +118804,49 @@ var compareVersions4 = (a, b) => {
|
|
|
118622
118804
|
}
|
|
118623
118805
|
return 0;
|
|
118624
118806
|
};
|
|
118807
|
+
|
|
118808
|
+
// packages/device-service-core/src/state-dir.ts
|
|
118809
|
+
import { readFileSync as readFileSync48, statSync as statSync10 } from "node:fs";
|
|
118810
|
+
import { homedir as homedir36 } from "node:os";
|
|
118811
|
+
import { dirname as dirname49, join as join120, posix as posix17, win32 as win3212 } from "node:path";
|
|
118812
|
+
var DEVICE_SERVICE_STATE_DIR_ENV = "OMO_DEVICE_SERVICE_STATE_DIR";
|
|
118813
|
+
var LOCATION_FILE = "device-service.location.json";
|
|
118814
|
+
var isAbsoluteOn = (platform, path) => (platform === "win32" ? win3212 : posix17).isAbsolute(path);
|
|
118815
|
+
function defaultStateDir(platform, env, home) {
|
|
118816
|
+
if (platform !== "win32")
|
|
118817
|
+
return join120(home, ".omo", "device-service");
|
|
118818
|
+
const localAppData = env.LOCALAPPDATA ?? join120(home, "AppData", "Local");
|
|
118819
|
+
return join120(localAppData, "OmO", "device-service");
|
|
118820
|
+
}
|
|
118821
|
+
function discoveredStateDir(platform, defaultDir) {
|
|
118822
|
+
try {
|
|
118823
|
+
const parsed = JSON.parse(readFileSync48(join120(dirname49(defaultDir), LOCATION_FILE), "utf8"));
|
|
118824
|
+
if (typeof parsed !== "object" || parsed === null || !("v" in parsed) || !("state_dir" in parsed))
|
|
118825
|
+
return;
|
|
118826
|
+
const { v, state_dir: stateDir } = parsed;
|
|
118827
|
+
if (v !== 1 || typeof stateDir !== "string" || !isAbsoluteOn(platform, stateDir))
|
|
118828
|
+
return;
|
|
118829
|
+
return statSync10(stateDir).isDirectory() ? stateDir : undefined;
|
|
118830
|
+
} catch {
|
|
118831
|
+
return;
|
|
118832
|
+
}
|
|
118833
|
+
}
|
|
118834
|
+
function deviceServiceStateDir(platform = process.platform, env = process.env, home = homedir36()) {
|
|
118835
|
+
const explicit = env[DEVICE_SERVICE_STATE_DIR_ENV];
|
|
118836
|
+
if (explicit !== undefined && explicit !== "" && isAbsoluteOn(platform, explicit))
|
|
118837
|
+
return explicit;
|
|
118838
|
+
const defaultDir = defaultStateDir(platform, env, home);
|
|
118839
|
+
return discoveredStateDir(platform, defaultDir) ?? defaultDir;
|
|
118840
|
+
}
|
|
118625
118841
|
// packages/device-service-core/src/device-service.ts
|
|
118626
118842
|
var ENDPOINT_COMMAND_WAIT_MS = 120000;
|
|
118627
118843
|
function sendToEndpoint(client, device, endpoint, rpc, locate) {
|
|
118844
|
+
return followDelegatedCommand(client, device, (commandId) => {
|
|
118845
|
+
const send = (asked) => client.endpointCommand(device, endpoint, rpc, commandId, { locate: asked });
|
|
118846
|
+
return send(locate).catch((error) => locate && error instanceof LocalApiError && error.code === "invalid_request" ? send(false) : Promise.reject(error));
|
|
118847
|
+
});
|
|
118848
|
+
}
|
|
118849
|
+
function followDelegatedCommand(client, device, send) {
|
|
118628
118850
|
return new Promise((resolve, reject) => {
|
|
118629
118851
|
const commandId = randomBytes9(16).toString("base64url");
|
|
118630
118852
|
const channel = followDelegatedChannel(device);
|
|
@@ -118659,8 +118881,7 @@ function sendToEndpoint(client, device, endpoint, rpc, locate) {
|
|
|
118659
118881
|
const timer = setTimeout(() => fail(new Error(`no final state for endpoint command ${commandId} within ${ENDPOINT_COMMAND_WAIT_MS} ms`)), ENDPOINT_COMMAND_WAIT_MS);
|
|
118660
118882
|
timer.unref?.();
|
|
118661
118883
|
client.closed.then(() => fail(new Error("the connection closed before the endpoint command settled")));
|
|
118662
|
-
|
|
118663
|
-
send(locate).catch((error) => locate && error instanceof LocalApiError && error.code === "invalid_request" ? send(false).catch(fail) : fail(error));
|
|
118884
|
+
send(commandId).catch(fail);
|
|
118664
118885
|
});
|
|
118665
118886
|
}
|
|
118666
118887
|
var markNotSent = (error) => error instanceof LocalApiError ? new LocalApiError(error.code, error.reason, {
|
|
@@ -118669,17 +118890,14 @@ var markNotSent = (error) => error instanceof LocalApiError ? new LocalApiError(
|
|
|
118669
118890
|
...error.path_refusal === undefined ? {} : { path_refusal: error.path_refusal },
|
|
118670
118891
|
not_sent: true
|
|
118671
118892
|
}) : error;
|
|
118672
|
-
function deviceServiceStateDir(platform = process.platform, env = process.env, home = homedir36()) {
|
|
118673
|
-
if (platform !== "win32")
|
|
118674
|
-
return join120(home, ".omo", "device-service");
|
|
118675
|
-
const localAppData = env.LOCALAPPDATA ?? join120(home, "AppData", "Local");
|
|
118676
|
-
return join120(localAppData, "OmO", "device-service");
|
|
118677
|
-
}
|
|
118678
118893
|
function deviceServiceEndpointPath(stateDir, platform = process.platform) {
|
|
118679
|
-
return
|
|
118894
|
+
return join121(stateDir, platform === "win32" ? ENDPOINT_FILE : SOCKET_FILE);
|
|
118680
118895
|
}
|
|
118681
118896
|
var ADOPT_ACCOUNT_MIN_SERVICE_VERSION = "0.1.3";
|
|
118682
118897
|
var acceptsAdoptAccount = (serviceVersion) => compareVersions4(serviceVersion, ADOPT_ACCOUNT_MIN_SERVICE_VERSION) >= 0;
|
|
118898
|
+
var WAKE_MARK_MIN_SERVICE_VERSION = "0.1.31";
|
|
118899
|
+
var LOCATE_SINGLE_MIN_SERVICE_VERSION = "0.1.13";
|
|
118900
|
+
var serviceAtLeast = (serviceVersion, minimum) => minimum !== null && compareVersions4(serviceVersion, minimum) >= 0;
|
|
118683
118901
|
async function connectDeviceService(options) {
|
|
118684
118902
|
const stateDir = options.stateDir ?? deviceServiceStateDir();
|
|
118685
118903
|
const client = await (options.connect ?? connectLocalApi)({
|
|
@@ -118687,8 +118905,14 @@ async function connectDeviceService(options) {
|
|
|
118687
118905
|
client: { name: "omo", version: options.version },
|
|
118688
118906
|
...options.background === true ? { transport: () => connectLocal(stateDir, { background: true }) } : {}
|
|
118689
118907
|
});
|
|
118908
|
+
const wakeMarkMinimum = minimumInEffect(options.minimums, "wakeMark", WAKE_MARK_MIN_SERVICE_VERSION);
|
|
118909
|
+
const carriesWakeMark = serviceAtLeast(client.welcome.service_version, wakeMarkMinimum);
|
|
118910
|
+
const takesSingleLocate = serviceAtLeast(client.welcome.service_version, minimumInEffect(options.minimums, "singleLocate", LOCATE_SINGLE_MIN_SERVICE_VERSION));
|
|
118690
118911
|
return {
|
|
118691
118912
|
serviceVersion: client.welcome.service_version,
|
|
118913
|
+
carriesWakeMark,
|
|
118914
|
+
wakeMarkMinimum,
|
|
118915
|
+
takesSingleLocate,
|
|
118692
118916
|
capabilities: client.welcome.capabilities,
|
|
118693
118917
|
initialStatus: client.welcome.state,
|
|
118694
118918
|
status: () => client.request("status.get", {}),
|
|
@@ -118706,6 +118930,8 @@ async function connectDeviceService(options) {
|
|
|
118706
118930
|
return stop;
|
|
118707
118931
|
},
|
|
118708
118932
|
setEnabled: async (enabled) => (await client.request("service.set_enabled", { enabled })).enabled,
|
|
118933
|
+
sessionWake: () => client.request("control.session_wake.get", {}),
|
|
118934
|
+
setSessionWake: (enabled) => client.request("control.session_wake.set", { enabled }),
|
|
118709
118935
|
attachControl: () => client.request("control.attach.get", {}),
|
|
118710
118936
|
setAttachControl: (attached) => client.request("control.attach.set", { attached }),
|
|
118711
118937
|
registerRefresher: async (binaryPath, version) => {
|
|
@@ -118726,7 +118952,10 @@ async function connectDeviceService(options) {
|
|
|
118726
118952
|
thisDevice: async () => (await client.request("device.info", {})).device,
|
|
118727
118953
|
devices: async () => (await client.request("devices.list", {})).devices,
|
|
118728
118954
|
sessions: newestRowsListing(client),
|
|
118729
|
-
attach: (device, sessionId) =>
|
|
118955
|
+
attach: async (device, sessionId) => {
|
|
118956
|
+
const attached = await openAttach(client, device, sessionId);
|
|
118957
|
+
return carriesWakeMark ? attached : { ...attached, command: (rpc) => attached.command(rpc) };
|
|
118958
|
+
},
|
|
118730
118959
|
endpointCommand: async (device, rpc, options) => {
|
|
118731
118960
|
let endpoint;
|
|
118732
118961
|
try {
|
|
@@ -118740,7 +118969,18 @@ async function connectDeviceService(options) {
|
|
|
118740
118969
|
},
|
|
118741
118970
|
close: () => client.close(),
|
|
118742
118971
|
closed: client.closed,
|
|
118743
|
-
locate: (device, engineId) => client.request("session.locate", {
|
|
118972
|
+
locate: (device, engineId, options) => client.request("session.locate", {
|
|
118973
|
+
device,
|
|
118974
|
+
engine_id: engineId,
|
|
118975
|
+
...options?.single === true && takesSingleLocate ? { single: true } : {}
|
|
118976
|
+
}),
|
|
118977
|
+
wakeCommand: async (device, durableId, rpc) => {
|
|
118978
|
+
if (!carriesWakeMark)
|
|
118979
|
+
throw new LocalApiError("unsupported", "this device service does not carry the wake target", { not_sent: true });
|
|
118980
|
+
return await followDelegatedCommand(client, device, (commandId) => client.wakeCommand(device, durableId, rpc, commandId).catch((error) => {
|
|
118981
|
+
throw error instanceof LocalApiError && error.command_id === undefined ? markNotSent(error) : error;
|
|
118982
|
+
}));
|
|
118983
|
+
}
|
|
118744
118984
|
};
|
|
118745
118985
|
}
|
|
118746
118986
|
// packages/device-service-core/src/bootstrap.ts
|
|
@@ -118803,6 +119043,11 @@ var forgetDeviceService = async (options) => {
|
|
|
118803
119043
|
}
|
|
118804
119044
|
return "forgotten";
|
|
118805
119045
|
};
|
|
119046
|
+
// packages/device-service-core/src/cold-wake/service-table.ts
|
|
119047
|
+
var SERVICE_TABLE_ENV = "OMO_RELAYD_SERVICES";
|
|
119048
|
+
|
|
119049
|
+
// packages/device-service-core/src/cold-wake/darwin.ts
|
|
119050
|
+
var TABLE_KEY = `EnvironmentVariables.${SERVICE_TABLE_ENV}`;
|
|
118806
119051
|
// packages/device-service-core/src/release/release-assets.ts
|
|
118807
119052
|
var MANIFEST = "latest.json";
|
|
118808
119053
|
var CHECKSUMS_MAX_BYTES = 64 * 1024;
|
|
@@ -118874,7 +119119,7 @@ var NONE2 = Symbol("none registered");
|
|
|
118874
119119
|
// packages/omo-native/package.json
|
|
118875
119120
|
var package_default4 = {
|
|
118876
119121
|
name: "omo-ai",
|
|
118877
|
-
version: "5.1.
|
|
119122
|
+
version: "5.1.72",
|
|
118878
119123
|
type: "module",
|
|
118879
119124
|
description: "OmO Native - the standalone omo command with the OMO extension built in: bun add -g omo-ai",
|
|
118880
119125
|
bin: {
|
|
@@ -118891,7 +119136,7 @@ var package_default4 = {
|
|
|
118891
119136
|
postinstall: "node bin/senpi-patch.mjs"
|
|
118892
119137
|
},
|
|
118893
119138
|
dependencies: {
|
|
118894
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
119139
|
+
"@code-yeongyu/senpi": "2026.11.15-2"
|
|
118895
119140
|
},
|
|
118896
119141
|
repository: {
|
|
118897
119142
|
type: "git",
|
|
@@ -118904,6 +119149,7 @@ var isRecord20 = (value) => typeof value === "object" && value !== null;
|
|
|
118904
119149
|
async function accountOf(api, credentials, doFetch) {
|
|
118905
119150
|
if (credentials.accountId !== undefined)
|
|
118906
119151
|
return credentials.accountId;
|
|
119152
|
+
refuseIfLocalOnly("omo-native/device-service-handoff.ts accountOf");
|
|
118907
119153
|
const response = await doFetch(`${api}/v1/me`, { headers: { authorization: `Bearer ${credentials.accessToken}` } });
|
|
118908
119154
|
if (!response.ok)
|
|
118909
119155
|
throw new Error(`the account read failed (${response.status})`);
|
|
@@ -119185,7 +119431,7 @@ async function boulder(options) {
|
|
|
119185
119431
|
}
|
|
119186
119432
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
119187
119433
|
import { spawn as spawn7 } from "node:child_process";
|
|
119188
|
-
import { existsSync as existsSync70, readFileSync as
|
|
119434
|
+
import { existsSync as existsSync70, readFileSync as readFileSync49, realpathSync as realpathSync14 } from "node:fs";
|
|
119189
119435
|
import { homedir as homedir37 } from "node:os";
|
|
119190
119436
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
119191
119437
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
@@ -119235,7 +119481,7 @@ function resolveLegacyLocalOmoBin(env, homeDir, currentExecutablePaths) {
|
|
|
119235
119481
|
}
|
|
119236
119482
|
function isGeneratedRuntimeWrapper(candidate) {
|
|
119237
119483
|
try {
|
|
119238
|
-
return
|
|
119484
|
+
return readFileSync49(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
119239
119485
|
} catch (error) {
|
|
119240
119486
|
if (error instanceof Error)
|
|
119241
119487
|
return false;
|
|
@@ -119670,7 +119916,7 @@ prunes.
|
|
|
119670
119916
|
|
|
119671
119917
|
// packages/omo-opencode/src/cli/config-migrate.ts
|
|
119672
119918
|
init_startup_migration();
|
|
119673
|
-
import { posix as
|
|
119919
|
+
import { posix as posix18 } from "node:path";
|
|
119674
119920
|
function reports(result) {
|
|
119675
119921
|
return result.results.map((entry) => ({
|
|
119676
119922
|
diagnostics: entry.diagnostics,
|
|
@@ -119704,7 +119950,7 @@ function runConfigMigrate(options = {}) {
|
|
|
119704
119950
|
dryRun: options.dryRun ?? false,
|
|
119705
119951
|
environment,
|
|
119706
119952
|
...homeDir === undefined ? {} : { env: { HOME: homeDir }, homeDir },
|
|
119707
|
-
pathOperations:
|
|
119953
|
+
pathOperations: posix18
|
|
119708
119954
|
});
|
|
119709
119955
|
const report = reports(result);
|
|
119710
119956
|
const response = {
|