@codexhost/cli-darwin-x64 0.19.0 → 0.20.0
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/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +24 -3
- package/app/console-web.js +1095 -682
- package/app/desktop-controller.mjs +40 -4
- package/app/host-runtime.mjs +1572 -1120
- package/app/plugins/antigravity/plugin.mjs +8753 -4274
- package/app/plugins/claude-code/plugin.mjs +26 -3
- package/app/plugins/codebuddy/plugin.mjs +41 -5
- package/app/plugins/codex-usage/plugin.mjs +26 -3
- package/app/plugins/copilot/plugin.mjs +26 -3
- package/app/plugins/cursor-cli/plugin.mjs +26 -3
- package/app/plugins/deepseek-harness/plugin.mjs +26 -3
- package/app/plugins/devin/plugin.mjs +25 -3
- package/app/plugins/grok/plugin.mjs +26 -3
- package/app/plugins/hermes/plugin.mjs +25 -3
- package/app/plugins/kimi-code/plugin.mjs +26 -3
- package/app/plugins/kiro-cli/plugin.mjs +26 -3
- package/app/plugins/omp/plugin.mjs +44 -6
- package/app/plugins/opencode/plugin.mjs +26 -3
- package/app/plugins/pi/plugin.mjs +45 -6
- package/app/plugins/qoder/plugin.mjs +48 -4
- package/app/plugins/qoder-cn/plugin.mjs +48 -4
- package/app/plugins/qwen-code/plugin.mjs +26 -3
- package/app/plugins/workbuddy/plugin.mjs +45 -8
- package/app/plugins/zcode/plugin.mjs +26 -3
- package/app/renderer-extension.js +1411 -737
- package/app/web/assets/index-D6-hvggd.css +1 -0
- package/app/web/assets/index-D85gPBbQ.js +201 -0
- package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
- package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
- package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
- package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
- package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
- package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
- package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
- package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
- package/app/web/codexhost-settings.js +1101 -684
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web-modules/server.mjs +138 -70
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BNQIOOHE.css +0 -1
- package/app/web/assets/index-Feo4BkqN.js +0 -199
|
@@ -67583,28 +67583,23 @@ var RpcRegistry = class {
|
|
|
67583
67583
|
};
|
|
67584
67584
|
|
|
67585
67585
|
// packages/web-server/src/access-token-rpc.ts
|
|
67586
|
-
function
|
|
67586
|
+
function managedAccessTokens(tokens) {
|
|
67587
67587
|
if (tokens === void 0)
|
|
67588
67588
|
throw new SessionRuntimeError("auth/disabled", "Authentication is not enabled", {});
|
|
67589
|
-
if (auth2?.local !== !0)
|
|
67590
|
-
throw new SessionRuntimeError(
|
|
67591
|
-
"auth/local-access-required",
|
|
67592
|
-
"This operation is only available on this computer",
|
|
67593
|
-
{ url: `http://127.0.0.1:${String(port)}` }
|
|
67594
|
-
);
|
|
67595
67589
|
return tokens;
|
|
67596
67590
|
}
|
|
67597
67591
|
function registerAccessTokenRpc(rpc2, tokens, listener) {
|
|
67598
|
-
|
|
67599
|
-
|
|
67600
|
-
managed(context);
|
|
67592
|
+
rpc2.register("codexhost/tailscaleServeSet", async (args) => {
|
|
67593
|
+
managedAccessTokens(tokens);
|
|
67601
67594
|
let { enabled } = external_exports.object({ enabled: external_exports.boolean() }).strict().parse(args);
|
|
67602
67595
|
return setTailscaleServe(listener.port(), enabled);
|
|
67603
|
-
}), rpc2.register("codexhost/accessTokenGet", async (
|
|
67596
|
+
}), rpc2.register("codexhost/accessTokenGet", async () => ({ ...managedAccessTokens(tokens).current(), ...await listener.access() })), rpc2.register(
|
|
67604
67597
|
"codexhost/accessTokenRegenerate",
|
|
67605
67598
|
async (_args, context) => {
|
|
67606
|
-
let store =
|
|
67607
|
-
|
|
67599
|
+
let store = managedAccessTokens(tokens);
|
|
67600
|
+
context.auth?.release();
|
|
67601
|
+
let next = store.regenerate();
|
|
67602
|
+
return context.auth?.renewCookie?.(next.secret), { ...next, ...await listener.access() };
|
|
67608
67603
|
}
|
|
67609
67604
|
);
|
|
67610
67605
|
}
|
|
@@ -67795,15 +67790,15 @@ function registerBackgroundControls(rpc2, tokens, options) {
|
|
|
67795
67790
|
throw new SessionRuntimeError("web/background-required", "Web is not running in background mode", {});
|
|
67796
67791
|
};
|
|
67797
67792
|
rpc2.register("codexhost/lanSet", (args, context) => {
|
|
67798
|
-
|
|
67793
|
+
managedAccessTokens(tokens), requireBackground();
|
|
67799
67794
|
let input = enabled.parse(args), changed = saveServiceOptions(options.data, {
|
|
67800
67795
|
host: input.enabled ? "0.0.0.0" : "127.0.0.1"
|
|
67801
67796
|
});
|
|
67802
67797
|
return changed && context.afterResponse?.(() => {
|
|
67803
67798
|
options.shutdown(SETTINGS_CHANGED_EXIT_CODE);
|
|
67804
67799
|
}), { changed };
|
|
67805
|
-
}), rpc2.register("codexhost/autostartSet", async (args
|
|
67806
|
-
|
|
67800
|
+
}), rpc2.register("codexhost/autostartSet", async (args) => {
|
|
67801
|
+
managedAccessTokens(tokens), requireBackground();
|
|
67807
67802
|
let input = enabled.parse(args);
|
|
67808
67803
|
return await autostart(options.launcher, input.enabled ? "on" : "off", options.npmEntrypoint), autostartState(options.launcher);
|
|
67809
67804
|
});
|
|
@@ -67911,12 +67906,24 @@ var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128, HARNESS_PERMISSION_MODE_LABEL_M
|
|
|
67911
67906
|
}).strict();
|
|
67912
67907
|
|
|
67913
67908
|
// packages/shared-contracts/dist/thread-usage.js
|
|
67914
|
-
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative(), finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative(), cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100),
|
|
67909
|
+
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative(), finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative(), cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100), usageOutputTimingSchema = external_exports.object({
|
|
67910
|
+
version: external_exports.literal(3).optional(),
|
|
67911
|
+
requestId: external_exports.string().min(1),
|
|
67912
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
67913
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
67914
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
67915
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
67916
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
67917
|
+
var usageMeasurementSchema = external_exports.object({
|
|
67918
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
|
|
67915
67919
|
value: finiteNonNegativeNumberSchema,
|
|
67916
67920
|
turnId: external_exports.string().min(1).max(1024),
|
|
67917
67921
|
at: nonNegativeSafeIntegerSchema
|
|
67918
67922
|
}).strict(), usageMeasurementsSchema = external_exports.object({
|
|
67919
|
-
|
|
67923
|
+
// Unversioned intervals can omit hidden thinking time; do not restore them into averages.
|
|
67924
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values2) => values2.filter((value) => value.version === 3)).optional(),
|
|
67925
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
67926
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
|
|
67920
67927
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
67921
67928
|
}).strict(), indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text3) => text3.length <= maximum)), composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
67922
67929
|
kind: external_exports.literal("countdown"),
|
|
@@ -67933,6 +67940,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
|
|
|
67933
67940
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
67934
67941
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
67935
67942
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
67943
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
67936
67944
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
67937
67945
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
67938
67946
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -68242,6 +68250,9 @@ var threadSteeringContextSchema = external_exports.object({
|
|
|
68242
68250
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
68243
68251
|
}).strict();
|
|
68244
68252
|
|
|
68253
|
+
// packages/shared-contracts/dist/thread-archive-confirm.js
|
|
68254
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm", threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict(), threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
68255
|
+
|
|
68245
68256
|
// packages/shared-contracts/dist/client-channel.js
|
|
68246
68257
|
var CLIENT_CHANNEL_VERSION = 1, CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
68247
68258
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict(), clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict(), clientThreadTreeReadParamsSchema = external_exports.object({}).strict(), clientThreadTreeSchema = external_exports.object({
|
|
@@ -68361,7 +68372,12 @@ var clientThreadPinsSchema = external_exports.object({ threadIds: external_expor
|
|
|
68361
68372
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
68362
68373
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
68363
68374
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
68364
|
-
command: external_exports.object({
|
|
68375
|
+
command: external_exports.object({
|
|
68376
|
+
name: external_exports.string().min(1),
|
|
68377
|
+
turn: clientTurnSchema,
|
|
68378
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
68379
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
68380
|
+
}).optional(),
|
|
68365
68381
|
thread: external_exports.object({
|
|
68366
68382
|
id: external_exports.string().min(1),
|
|
68367
68383
|
cwd: external_exports.string(),
|
|
@@ -68550,7 +68566,7 @@ var webNetworkAccessUrlSchema = external_exports.object({
|
|
|
68550
68566
|
customHostname: external_exports.string().optional(),
|
|
68551
68567
|
quotaUntil: external_exports.string().optional()
|
|
68552
68568
|
}).strict().optional()
|
|
68553
|
-
}).strict()
|
|
68569
|
+
}).strict();
|
|
68554
68570
|
|
|
68555
68571
|
// packages/shared-contracts/dist/delegation-read.js
|
|
68556
68572
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -69598,16 +69614,16 @@ function encodeOfficialCodexModelRef(nativeModelId, serviceTier) {
|
|
|
69598
69614
|
var workspaceContractVersionSchema = external_exports.literal(1);
|
|
69599
69615
|
|
|
69600
69616
|
// packages/web-server/src/ui-extension-rpc.ts
|
|
69601
|
-
function registerUiExtensionRpc(rpc2, extensions3
|
|
69602
|
-
let
|
|
69603
|
-
if (context.auth
|
|
69617
|
+
function registerUiExtensionRpc(rpc2, extensions3) {
|
|
69618
|
+
let authenticated = (context) => {
|
|
69619
|
+
if (context.auth === void 0)
|
|
69604
69620
|
throw new SessionRuntimeError(
|
|
69605
|
-
"auth/
|
|
69606
|
-
"
|
|
69607
|
-
{
|
|
69621
|
+
"auth/disabled",
|
|
69622
|
+
"Authentication must be enabled to manage Web extensions.",
|
|
69623
|
+
{}
|
|
69608
69624
|
);
|
|
69609
69625
|
}, mutate = async (context, operation) => {
|
|
69610
|
-
|
|
69626
|
+
authenticated(context);
|
|
69611
69627
|
try {
|
|
69612
69628
|
return await operation();
|
|
69613
69629
|
} catch (error51) {
|
|
@@ -69618,7 +69634,7 @@ function registerUiExtensionRpc(rpc2, extensions3, options) {
|
|
|
69618
69634
|
);
|
|
69619
69635
|
}
|
|
69620
69636
|
};
|
|
69621
|
-
rpc2.register("codexhost/uiExtensions/list", (_args, context) => (
|
|
69637
|
+
rpc2.register("codexhost/uiExtensions/list", (_args, context) => (authenticated(context), extensions3.state())), rpc2.register(
|
|
69622
69638
|
"codexhost/uiExtensions/install",
|
|
69623
69639
|
(args, context) => mutate(context, () => {
|
|
69624
69640
|
let { spec, registry: registry2 } = webUiExtensionInstallSchema.parse(args);
|
|
@@ -69656,7 +69672,7 @@ var UI_EXTENSION_PAGE = `<!doctype html>
|
|
|
69656
69672
|
<script>
|
|
69657
69673
|
const list=document.getElementById('list'),error=document.getElementById('error'),status=document.getElementById('status');
|
|
69658
69674
|
function text(tag,value,parent){const node=document.createElement(tag);node.textContent=value;parent.appendChild(node);return node}
|
|
69659
|
-
async function rpc(action,args={}){const response=await fetch('api/codexhost/uiExtensions/'+action,{method:'POST',credentials:'same-origin',headers:{'content-type':'application/json'},body:JSON.stringify({type:'client-request',rpcId:'extensions-'+Date.now(),method:'codexhost/uiExtensions/'+action,payload:{args}})});if(!response.ok)throw new Error('HTTP '+response.status);const reply=await response.json();if(!reply.result.ok)throw new Error(reply.result.error.code==='auth/
|
|
69675
|
+
async function rpc(action,args={}){const response=await fetch('api/codexhost/uiExtensions/'+action,{method:'POST',credentials:'same-origin',headers:{'content-type':'application/json'},body:JSON.stringify({type:'client-request',rpcId:'extensions-'+Date.now(),method:'codexhost/uiExtensions/'+action,payload:{args}})});if(!response.ok)throw new Error('HTTP '+response.status);const reply=await response.json();if(!reply.result.ok)throw new Error(reply.result.error.code==='auth/disabled'?'\u672A\u542F\u7528\u8BBF\u95EE\u8BA4\u8BC1\u65F6\u4E0D\u80FD\u7BA1\u7406\u754C\u9762\u6269\u5C55\u3002Enable authentication to manage extensions.':reply.result.error.message);return reply.result.value}
|
|
69660
69676
|
function render(state){list.replaceChildren();status.textContent=state.safeMode?'\u5F53\u524D\u4EE5\u4EC5\u5185\u7F6E\u6A21\u5F0F\u8FD0\u884C / Built-in-only mode':state.extensions.length+' \u4E2A\u5DF2\u5B89\u88C5\u6269\u5C55 / installed extensions';if(state.storeError)error.textContent=state.storeError;for(const item of state.extensions){const row=document.createElement('article');list.appendChild(row);text('h2',item.name+' '+item.version,row);const enabled=item.enabledTargets.includes('web');text('p',(enabled?'\u5DF2\u542F\u7528 Web / Web enabled':'\u5DF2\u7981\u7528 / Disabled')+' \xB7 '+(state.loadedIds.includes(item.id)?'\u670D\u52A1\u7AEF\u5DF2\u52A0\u8F7D / Loaded on server':'\u670D\u52A1\u7AEF\u672A\u52A0\u8F7D / Not loaded on server'),row);if(item.loadError)text('p',item.loadError,row);const actions=text('div','',row);actions.className='actions';const toggle=text('button',enabled?'\u7981\u7528 / Disable':'\u542F\u7528 / Enable',actions);toggle.onclick=()=>run('setEnabled',{id:item.id,enabled:!enabled});const remove=text('button','\u5378\u8F7D / Remove',actions);remove.onclick=()=>run('remove',{id:item.id})}}
|
|
69661
69677
|
let busy=false;
|
|
69662
69678
|
async function run(action,args){if(busy)return;busy=true;error.textContent='';document.querySelectorAll('button,input,select').forEach(b=>b.disabled=true);try{render(await rpc(action,args))}catch(e){error.textContent=e.message}finally{busy=false;document.querySelectorAll('button,input,select').forEach(b=>b.disabled=false)}}
|
|
@@ -71686,8 +71702,8 @@ var AccessAuth = class {
|
|
|
71686
71702
|
if ((pathname === "/" || pathname === "/index.html") && this.exchange(request3, response))
|
|
71687
71703
|
return { handled: !0 };
|
|
71688
71704
|
let presented = presentedToken(request3, this.trust.secure(request3)), credential = presented === void 0 ? void 0 : this.credentialFor(presented.token, request3);
|
|
71689
|
-
if (credential !== void 0) {
|
|
71690
|
-
let auth2 = this.admit(request3, response, credential);
|
|
71705
|
+
if (presented !== void 0 && credential !== void 0) {
|
|
71706
|
+
let auth2 = this.admit(request3, response, credential, presented.source);
|
|
71691
71707
|
return pathname !== "/api/auth/status" ? { handled: !1, auth: auth2 } : (response.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" }).end(JSON.stringify({ authenticated: !0, local: auth2.local })), { handled: !0 });
|
|
71692
71708
|
}
|
|
71693
71709
|
if (PUBLIC_ASSET.test(pathname)) return { handled: !1, auth: void 0 };
|
|
@@ -71716,11 +71732,19 @@ Connection: close\r
|
|
|
71716
71732
|
`
|
|
71717
71733
|
), socket.destroy(), !1;
|
|
71718
71734
|
}
|
|
71719
|
-
admit(request3, response, credential) {
|
|
71735
|
+
admit(request3, response, credential, source) {
|
|
71720
71736
|
return this.trust.authenticated(request3), {
|
|
71721
71737
|
credential,
|
|
71722
71738
|
local: isLocalConnection(request3),
|
|
71723
|
-
release: this.connections.track(credential, response)
|
|
71739
|
+
release: this.connections.track(credential, response),
|
|
71740
|
+
...source === "cookie" && credential !== LOCAL_CREDENTIAL ? {
|
|
71741
|
+
renewCookie: (secret) => {
|
|
71742
|
+
response.setHeader(
|
|
71743
|
+
"set-cookie",
|
|
71744
|
+
this.cookie(request3, secret, COOKIE_MAX_AGE_SECONDS)
|
|
71745
|
+
);
|
|
71746
|
+
}
|
|
71747
|
+
} : {}
|
|
71724
71748
|
};
|
|
71725
71749
|
}
|
|
71726
71750
|
/** Count an invalid token unless the address is already blocked. */
|
|
@@ -72804,9 +72828,9 @@ var RemoteRelay = class {
|
|
|
72804
72828
|
};
|
|
72805
72829
|
|
|
72806
72830
|
// packages/web-server/src/remote-relay/rpc.ts
|
|
72807
|
-
function registerRelayRpc(rpc2, tokens,
|
|
72808
|
-
rpc2.register("codexhost/relaySet", (args
|
|
72809
|
-
|
|
72831
|
+
function registerRelayRpc(rpc2, tokens, relay2) {
|
|
72832
|
+
rpc2.register("codexhost/relaySet", (args) => {
|
|
72833
|
+
managedAccessTokens(tokens);
|
|
72810
72834
|
let { enabled, name: name2, invite, kind, host } = external_exports.object({
|
|
72811
72835
|
enabled: external_exports.boolean(),
|
|
72812
72836
|
kind: webRelayKindSchema.optional(),
|
|
@@ -75627,7 +75651,9 @@ var SessionLog = class {
|
|
|
75627
75651
|
epoch: this.epoch,
|
|
75628
75652
|
...canResume ? { resumedAfter: resume.cursor } : {},
|
|
75629
75653
|
header: this.header,
|
|
75630
|
-
cursor
|
|
75654
|
+
// The wire's empty-journal cursor is -1 whatever this journal's rendering origin is;
|
|
75655
|
+
// the first entry then arrives as a gap that the client repairs with a page read.
|
|
75656
|
+
cursor: this.events.length === 0 ? -1 : this.lastSeq,
|
|
75631
75657
|
records: this.events.slice(window2.start, this.events.length).map((event) => ({ type: "event", event })),
|
|
75632
75658
|
hasMore: window2.start > 0 || this.hasEarlier(),
|
|
75633
75659
|
projections: this.projectionBaseline(),
|
|
@@ -76784,15 +76810,19 @@ var ChCommandPresentation = class {
|
|
|
76784
76810
|
);
|
|
76785
76811
|
if (compacting !== this.compacting && (this.log.setProjection("compacting", compacting), this.compacting = compacting), !command) return;
|
|
76786
76812
|
let { turn, name: name2 } = command;
|
|
76787
|
-
if (this.current?.id !== turn.id
|
|
76788
|
-
|
|
76789
|
-
|
|
76790
|
-
|
|
76791
|
-
|
|
76792
|
-
|
|
76793
|
-
|
|
76794
|
-
|
|
76795
|
-
|
|
76813
|
+
if (this.current?.id !== turn.id) {
|
|
76814
|
+
if (this.current && !this.current.done && (this.log.append("command/done", {
|
|
76815
|
+
commandId: this.current.id,
|
|
76816
|
+
kind: "error",
|
|
76817
|
+
text: "The Host no longer reports the outcome of this command."
|
|
76818
|
+
}), this.current.done = !0), !commandRunning && command.subsequentTurnId !== void 0) return;
|
|
76819
|
+
this.log.append("command/run", {
|
|
76820
|
+
commandId: turn.id,
|
|
76821
|
+
name: name2,
|
|
76822
|
+
source: { kind: "user" }
|
|
76823
|
+
}), this.current = { id: turn.id, done: !1 };
|
|
76824
|
+
}
|
|
76825
|
+
if (commandRunning || this.current.done) return;
|
|
76796
76826
|
let success2 = turn.status === "completed", text3 = success2 ? turn.items.filter((item) => item.type === "agentMessage" && typeof item.text == "string").map((item) => item.text).join(`
|
|
76797
76827
|
`) || void 0 : turn.error?.message ?? (turn.status === "interrupted" ? "Command cancelled." : "Command failed.");
|
|
76798
76828
|
this.log.append("command/done", {
|
|
@@ -77363,6 +77393,21 @@ var THREAD_TREE_ANCESTOR_LIMIT = 64, ChThreadTree = class {
|
|
|
77363
77393
|
} catch {
|
|
77364
77394
|
}
|
|
77365
77395
|
}
|
|
77396
|
+
async readArchivedIds() {
|
|
77397
|
+
let ids = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set(), archived;
|
|
77398
|
+
for (; ; ) {
|
|
77399
|
+
let page = await this.host.request(THREAD_CATALOG_READ_METHOD, {
|
|
77400
|
+
includeArchived: !0,
|
|
77401
|
+
officialCursor: { live: null, ...archived === void 0 ? {} : { archived } }
|
|
77402
|
+
});
|
|
77403
|
+
for (let id of page.archivedThreadIds) ids.add(id);
|
|
77404
|
+
let next = page.officialCursor?.archived;
|
|
77405
|
+
if (next == null) return ids;
|
|
77406
|
+
if (seen.has(next))
|
|
77407
|
+
throw new SessionRuntimeError("host/catalog-invalid", "Host archive cursor did not advance.");
|
|
77408
|
+
seen.add(next), archived = next;
|
|
77409
|
+
}
|
|
77410
|
+
}
|
|
77366
77411
|
async archive(id, archived, archivedIds, setArchived) {
|
|
77367
77412
|
await this.refresh();
|
|
77368
77413
|
let children = /* @__PURE__ */ new Map();
|
|
@@ -77370,10 +77415,12 @@ var THREAD_TREE_ANCESTOR_LIMIT = 64, ChThreadTree = class {
|
|
|
77370
77415
|
let list = children.get(parent) ?? [];
|
|
77371
77416
|
list.push(child), children.set(parent, list);
|
|
77372
77417
|
}
|
|
77373
|
-
let queue = [id], visited = /* @__PURE__ */ new Set(), failedSessionIds = [];
|
|
77418
|
+
let queue = [id], visited = /* @__PURE__ */ new Set(), failedSessionIds = [], confirmedArchiveIds;
|
|
77374
77419
|
for (let next of queue)
|
|
77375
|
-
if (!visited.has(next) && (visited.add(next), queue.push(...children.get(next) ?? []), !(next !== id && archivedIds.has(next)
|
|
77420
|
+
if (!visited.has(next) && (visited.add(next), queue.push(...children.get(next) ?? []), !(next !== id && archived && archivedIds.has(next))))
|
|
77376
77421
|
try {
|
|
77422
|
+
if (next !== id && !archived && !archivedIds.has(next) && (confirmedArchiveIds ??= this.readArchivedIds(), !(await confirmedArchiveIds).has(next)))
|
|
77423
|
+
continue;
|
|
77377
77424
|
await setArchived(next);
|
|
77378
77425
|
} catch (error51) {
|
|
77379
77426
|
if (next === id) throw error51;
|
|
@@ -78481,16 +78528,18 @@ var ChSessions = class {
|
|
|
78481
78528
|
catalog: async () => {
|
|
78482
78529
|
await this.refresh();
|
|
78483
78530
|
},
|
|
78484
|
-
archived: (id, archived) =>
|
|
78531
|
+
archived: (id, archived) => {
|
|
78532
|
+
this.archiveOperations.delete(id), this.updateArchive(id, archived);
|
|
78533
|
+
},
|
|
78485
78534
|
connection: (online) => {
|
|
78486
|
-
this.hostOnline = online, online || this.interactions?.clear();
|
|
78535
|
+
this.hostOnline = online, online || (this.archiveOperations.clear(), this.interactions?.clear());
|
|
78487
78536
|
for (let [, view] of this.threads.views())
|
|
78488
78537
|
view.log.setProjection("nativeConnection", {
|
|
78489
78538
|
state: online ? "connected" : "reconnecting"
|
|
78490
78539
|
});
|
|
78491
78540
|
},
|
|
78492
78541
|
reset: (epoch, full) => {
|
|
78493
|
-
if (full && this.hostEpoch === epoch && this.threads.forgetKnownTurns(), this.hostEpoch && this.hostEpoch !== epoch) {
|
|
78542
|
+
if (this.archiveOperations.clear(), full && this.hostEpoch === epoch && this.threads.forgetKnownTurns(), this.hostEpoch && this.hostEpoch !== epoch) {
|
|
78494
78543
|
this.interactions?.clear();
|
|
78495
78544
|
for (let view of this.threads.newHostGeneration()) view.log.reconnectFollowers();
|
|
78496
78545
|
}
|
|
@@ -78527,6 +78576,7 @@ var ChSessions = class {
|
|
|
78527
78576
|
refreshingCatalog = !1;
|
|
78528
78577
|
refreshingArchives = !1;
|
|
78529
78578
|
refreshingArchiveChanges;
|
|
78579
|
+
archiveOperations = /* @__PURE__ */ new Map();
|
|
78530
78580
|
refreshingTiming;
|
|
78531
78581
|
catalogReadAt = -1 / 0;
|
|
78532
78582
|
timer;
|
|
@@ -79002,18 +79052,37 @@ var ChSessions = class {
|
|
|
79002
79052
|
archived ? ids.add(id) : ids.delete(id), this.workspaces.setReferenceArchives([...ids].sort());
|
|
79003
79053
|
}
|
|
79004
79054
|
async setArchived(sessionId, archived) {
|
|
79005
|
-
let id = this.id(sessionId);
|
|
79006
|
-
|
|
79007
|
-
|
|
79008
|
-
|
|
79009
|
-
|
|
79010
|
-
|
|
79011
|
-
|
|
79012
|
-
|
|
79013
|
-
|
|
79055
|
+
let id = this.id(sessionId), operation = /* @__PURE__ */ Symbol();
|
|
79056
|
+
this.archiveOperations.set(id, operation);
|
|
79057
|
+
try {
|
|
79058
|
+
if (this.drafts.has(id))
|
|
79059
|
+
throw new SessionRuntimeError(
|
|
79060
|
+
"session/not-started",
|
|
79061
|
+
"Send the first message before archiving this Thread."
|
|
79062
|
+
);
|
|
79063
|
+
if (!this.threads.hasHarness(id)) {
|
|
79064
|
+
let { thread: thread2, harnessId } = await this.readThread(id);
|
|
79065
|
+
this.rows.set(id, thread2), this.threads.setHarness(id, harnessId);
|
|
79066
|
+
}
|
|
79067
|
+
let owner = await this.owner(id);
|
|
79068
|
+
if (this.archiveOperations.get(id) !== operation) return;
|
|
79069
|
+
try {
|
|
79070
|
+
await this.host.request(archived ? "thread/archive" : "thread/unarchive", { threadId: id });
|
|
79071
|
+
} catch (error51) {
|
|
79072
|
+
if (!archived || owner.owner !== "codex" || !(error51 instanceof SessionRuntimeError) || error51.code !== "host/rejected" || !("hostCode" in error51.details) || error51.details.hostCode !== -32600 || error51.message !== `no rollout found for thread id ${id}` || (await this.refreshing?.catch(() => {
|
|
79073
|
+
}), this.archiveOperations.get(id) !== operation)) throw error51;
|
|
79074
|
+
let confirmation = await this.host.request(THREAD_ARCHIVE_CONFIRM_METHOD, { threadId: id }).then((value) => threadArchiveConfirmResultSchema.safeParse(value)).catch(() => {
|
|
79075
|
+
});
|
|
79076
|
+
if (!confirmation?.success || !confirmation.data.confirmed || this.archiveOperations.get(id) !== operation)
|
|
79077
|
+
throw error51;
|
|
79078
|
+
this.updateArchive(id, !0);
|
|
79079
|
+
return;
|
|
79080
|
+
}
|
|
79081
|
+
await this.refreshing?.catch(() => {
|
|
79082
|
+
}), this.archiveOperations.get(id) === operation && this.updateArchive(id, archived);
|
|
79083
|
+
} finally {
|
|
79084
|
+
this.archiveOperations.get(id) === operation && this.archiveOperations.delete(id);
|
|
79014
79085
|
}
|
|
79015
|
-
await this.owner(id), await this.host.request(archived ? "thread/archive" : "thread/unarchive", { threadId: id }), await this.refreshing?.catch(() => {
|
|
79016
|
-
}), this.updateArchive(id, archived);
|
|
79017
79086
|
}
|
|
79018
79087
|
async readThread(id) {
|
|
79019
79088
|
let owner = await this.owner(id), { thread: thread2 } = await this.host.request(
|
|
@@ -79368,6 +79437,7 @@ var ChSessions = class {
|
|
|
79368
79437
|
])
|
|
79369
79438
|
rpc2.register(method2, async (args) => {
|
|
79370
79439
|
let { sessionId } = requestOf(args);
|
|
79440
|
+
this.archiveOperations.delete(this.id(sessionId));
|
|
79371
79441
|
try {
|
|
79372
79442
|
await this.tree.archive(
|
|
79373
79443
|
this.id(sessionId),
|
|
@@ -79543,7 +79613,7 @@ var ChSessions = class {
|
|
|
79543
79613
|
throw new SessionRuntimeError("host/import-explicit", "CH imports must be explicitly selected.");
|
|
79544
79614
|
}
|
|
79545
79615
|
async close() {
|
|
79546
|
-
this.fileReferences.close(), this.skills.close(), this.closed = !0, this.titleRequests.clear(), this.pins.close(), this.realtime?.close(), this.interactions?.clear(), clearInterval(this.timer), this.host.close();
|
|
79616
|
+
this.fileReferences.close(), this.skills.close(), this.closed = !0, this.archiveOperations.clear(), this.titleRequests.clear(), this.pins.close(), this.realtime?.close(), this.interactions?.clear(), clearInterval(this.timer), this.host.close();
|
|
79547
79617
|
for (let sink of this.controls) sink.end();
|
|
79548
79618
|
}
|
|
79549
79619
|
};
|
|
@@ -82777,6 +82847,7 @@ async function readDescriptor(path8) {
|
|
|
82777
82847
|
import { homedir as homedir7 } from "node:os";
|
|
82778
82848
|
import { join as join16, resolve as resolve11 } from "node:path";
|
|
82779
82849
|
var exec3 = promisify5(execFile5), METHODS = /* @__PURE__ */ new Set([
|
|
82850
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
82780
82851
|
"codexhost/thread/tree/read",
|
|
82781
82852
|
"codexhost/thread/pins/list",
|
|
82782
82853
|
"codexhost/thread/pins/set",
|
|
@@ -99338,8 +99409,8 @@ function formatWebStartup(options) {
|
|
|
99338
99409
|
options.qrCode.trimEnd()
|
|
99339
99410
|
), options.localManagementUnavailable === !0 && lines.push(
|
|
99340
99411
|
"",
|
|
99341
|
-
"This address is not this computer's local address, so
|
|
99342
|
-
"Listen on 127.0.0.1 or 0.0.0.0
|
|
99412
|
+
"This address is not this computer's local address, so automatic local sign-in via ?token= is unavailable.",
|
|
99413
|
+
"Listen on 127.0.0.1 or 0.0.0.0 for an automatic local sign-in link."
|
|
99343
99414
|
), lines.push("", "Keep access links private.", ""), lines.join(`
|
|
99344
99415
|
`);
|
|
99345
99416
|
}
|
|
@@ -100303,16 +100374,13 @@ registerAccessTokenRpc(rpc, accessTokens, {
|
|
|
100303
100374
|
});
|
|
100304
100375
|
registerBackgroundControls(rpc, accessTokens, {
|
|
100305
100376
|
background: background !== void 0,
|
|
100306
|
-
port: () => listeningPort,
|
|
100307
100377
|
data,
|
|
100308
100378
|
launcher,
|
|
100309
100379
|
npmEntrypoint,
|
|
100310
100380
|
shutdown
|
|
100311
100381
|
});
|
|
100312
100382
|
registerMisc(rpc, { events });
|
|
100313
|
-
registerUiExtensionRpc(rpc, extensions2
|
|
100314
|
-
port: () => server.address().port
|
|
100315
|
-
});
|
|
100383
|
+
registerUiExtensionRpc(rpc, extensions2);
|
|
100316
100384
|
registerVoiceStatus(rpc, chHost);
|
|
100317
100385
|
var IMMUTABLE_CACHE = "public, max-age=31536000, immutable", HARNESS_ICON_CACHE = devWebUi === void 0 ? "private, max-age=86400, stale-while-revalidate=604800" : "no-cache";
|
|
100318
100386
|
async function send(request3, response, asset, cacheControl = "no-cache") {
|
|
@@ -100506,7 +100574,7 @@ var server = createWebServer((request3, response) => {
|
|
|
100506
100574
|
console.error("[http] request failed", error51), response.headersSent ? response.destroy() : response.writeHead(500).end("internal error");
|
|
100507
100575
|
});
|
|
100508
100576
|
}), relay = new RemoteRelay(data, accessTokens !== void 0, server, trust);
|
|
100509
|
-
registerRelayRpc(rpc, accessTokens,
|
|
100577
|
+
registerRelayRpc(rpc, accessTokens, relay);
|
|
100510
100578
|
serviceOptions.relayEnabled && relay.start();
|
|
100511
100579
|
var wss = createBrowserWebSocketServer(), sidebarBrowser = new SidebarBrowser({ profileDirectory: join31(dataRoot, "sidebar-browser") });
|
|
100512
100580
|
server.on("upgrade", (request3, socket, head) => {
|
package/bin/codexhost
CHANGED
|
Binary file
|
package/libexec/codexhost-shim
CHANGED
|
Binary file
|
|
Binary file
|