@p4code/cli 0.1.10 → 0.1.12
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/bin.mjs +409 -16
- package/dist/client/assets/{DiffPanel-BRroAgOK.js → DiffPanel-DLEF2Os4.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-Bdd2Ml_z.js → FilePreviewPanel-8D_2Xs92.js} +2 -2
- package/dist/client/assets/{PreviewPanel-DoJd5FXR.js → PreviewPanel-DiR-_u2D.js} +2 -2
- package/dist/client/assets/{angular-html-BA0WzHZ0.js → angular-html-CMBWPyD3.js} +2 -2
- package/dist/client/assets/{angular-ts-BehluKB7.js → angular-ts-BatZhjLf.js} +2 -2
- package/dist/client/assets/{apl-DPnuuIo7.js → apl-Cx1sW3hC.js} +2 -2
- package/dist/client/assets/arrow-right-D6CCHJEU.js +2 -0
- package/dist/client/assets/{astro-G6Zz-WSX.js → astro-nMa7HQcv.js} +2 -2
- package/dist/client/assets/{blade-c1NgE6B9.js → blade-JxAt8tFv.js} +2 -2
- package/dist/client/assets/{c-BbDaxzL5.js → c-C-yEqtHp.js} +2 -2
- package/dist/client/assets/{cobol-DPWRf7_s.js → cobol-CA3DrkO1.js} +2 -2
- package/dist/client/assets/{coffee-kZI3-HKr.js → coffee-CNzul851.js} +2 -2
- package/dist/client/assets/{cpp-DbB1uwNF.js → cpp-DYasO6ny.js} +2 -2
- package/dist/client/assets/{crystal-C9rif4zq.js → crystal-BkYnv3Y5.js} +2 -2
- package/dist/client/assets/{css-BzXrG2ii.js → css-GnxXZE-U.js} +2 -2
- package/dist/client/assets/{edge-CIqg8jED.js → edge-DHx6AdO-.js} +2 -2
- package/dist/client/assets/{elixir-L1xpfUlV.js → elixir-XiEvMT4-.js} +2 -2
- package/dist/client/assets/{elm-C4bqF3BU.js → elm-BY4GYI5F.js} +2 -2
- package/dist/client/assets/{erb-DQxpBRS7.js → erb-DDG6lOki.js} +2 -2
- package/dist/client/assets/{fileCommentAnnotations-DXLRihuo.js → fileCommentAnnotations-BTZDcAeh.js} +2 -2
- package/dist/client/assets/{git-rebase-DCFBvSos.js → git-rebase-BDUy60An.js} +2 -2
- package/dist/client/assets/{glimmer-js-CMcw0KDm.js → glimmer-js-Dpr_XG7j.js} +2 -2
- package/dist/client/assets/{glimmer-ts-zKGsihEs.js → glimmer-ts-CtZ0ZipS.js} +2 -2
- package/dist/client/assets/{glsl-C-DKYe1o.js → glsl-DHtQlcKL.js} +2 -2
- package/dist/client/assets/{graphql-D-Jaf-It.js → graphql-DtNuYKEb.js} +2 -2
- package/dist/client/assets/{hack-Cy1Ek-eJ.js → hack-BqNfldCe.js} +2 -2
- package/dist/client/assets/{haml-DSBhTnP_.js → haml-mPiLB45s.js} +2 -2
- package/dist/client/assets/{handlebars-BTjhBiVA.js → handlebars-BLxX_l2A.js} +2 -2
- package/dist/client/assets/{html-CuFf_rJP.js → html-DU5G3F4s.js} +2 -2
- package/dist/client/assets/{html-derivative-B6vKETtb.js → html-derivative-BMJPXTuS.js} +2 -2
- package/dist/client/assets/{http-TaTxS49l.js → http-6kGF1eof.js} +2 -2
- package/dist/client/assets/{hurl-Jwth1u4b.js → hurl-CvT1bXUG.js} +2 -2
- package/dist/client/assets/{index-WQyWsxuV.js → index-JvBwT8k1.js} +201 -201
- package/dist/client/assets/{java-Ba5MdLVF.js → java-bBnbDfw8.js} +2 -2
- package/dist/client/assets/{javascript-_mHojD6_.js → javascript-CpOINVUc.js} +2 -2
- package/dist/client/assets/{jinja-BhX9YpO0.js → jinja-CItwptlU.js} +2 -2
- package/dist/client/assets/{jison-S0Rrxw4o.js → jison-BWvHru6a.js} +2 -2
- package/dist/client/assets/{json-B-G4K1LM.js → json-ClObSVU5.js} +2 -2
- package/dist/client/assets/{jsx-X6TBdO7T.js → jsx-vHozUqKh.js} +2 -2
- package/dist/client/assets/{julia-He6A0R8c.js → julia-CITEF0SC.js} +2 -2
- package/dist/client/assets/{just-CQ533yYC.js → just-CAMHq4cU.js} +2 -2
- package/dist/client/assets/{latex-BBBRtbj7.js → latex-BHB-Vy2g.js} +2 -2
- package/dist/client/assets/{liquid-CA9B-Q_J.js → liquid-rsijXGco.js} +2 -2
- package/dist/client/assets/{lua-DXLYC8yx.js → lua-CPA1zmkS.js} +2 -2
- package/dist/client/assets/{marko-BXfllCK7.js → marko-D9CJEgH2.js} +2 -2
- package/dist/client/assets/{mdc-D13Xs_kf.js → mdc-DL5ptUuf.js} +2 -2
- package/dist/client/assets/{nginx-HcisF7-i.js → nginx-DAAmFPDe.js} +2 -2
- package/dist/client/assets/{nim-YbKRMFDo.js → nim-DmaHLOWa.js} +2 -2
- package/dist/client/assets/{perl-CV978rzN.js → perl-Bw03qQ4D.js} +2 -2
- package/dist/client/assets/{php-B8Rmr1r4.js → php-DdSlZ5fF.js} +2 -2
- package/dist/client/assets/{pug-CI1Ka8om.js → pug-CgQdUdQK.js} +2 -2
- package/dist/client/assets/{qml-CyQLZsMJ.js → qml-6-Z__KDk.js} +2 -2
- package/dist/client/assets/{r-C-0JMTYO.js → r-BwsNM1XU.js} +2 -2
- package/dist/client/assets/{razor-BCppTDFk.js → razor-DRWY5qRs.js} +2 -2
- package/dist/client/assets/{regexp-DWt_neai.js → regexp-BGiLplmg.js} +2 -2
- package/dist/client/assets/{rst-CDLeyhcr.js → rst-CND1NmX_.js} +2 -2
- package/dist/client/assets/{ruby-Bq-7Grqk.js → ruby-Dlxt-z_r.js} +2 -2
- package/dist/client/assets/{sas-Cn10Nqsd.js → sas-DFeunfku.js} +2 -2
- package/dist/client/assets/{scss-821PYndD.js → scss-D_BTo2XD.js} +2 -2
- package/dist/client/assets/{shellscript-CGnWrTWh.js → shellscript-cEuOjvsv.js} +2 -2
- package/dist/client/assets/{shellsession-SoJX0uTA.js → shellsession-CeWrE-Lw.js} +2 -2
- package/dist/client/assets/{soy-BDpemwx6.js → soy-DdFNKMwD.js} +2 -2
- package/dist/client/assets/{sql-BAre1tMG.js → sql-3jzdtF3L.js} +2 -2
- package/dist/client/assets/{stata-BVoUBbRH.js → stata-CfftDdbo.js} +2 -2
- package/dist/client/assets/{surrealql-77kldaFv.js → surrealql-BgLa39M_.js} +2 -2
- package/dist/client/assets/{svelte-BrVa4Wrm.js → svelte-CJNznzEX.js} +2 -2
- package/dist/client/assets/{templ-DD-yE4Ei.js → templ-DiQ0ONH_.js} +2 -2
- package/dist/client/assets/{tex-3Cd89BRS.js → tex-Dj5-ewTi.js} +2 -2
- package/dist/client/assets/textarea-CtwXMNmJ.js +46 -0
- package/dist/client/assets/{ts-tags-CqnWMU9s.js → ts-tags-Rut2YPAl.js} +2 -2
- package/dist/client/assets/{tsx-C56Uu7is.js → tsx-TxGWIfKc.js} +2 -2
- package/dist/client/assets/{twig-2EWf2LgK.js → twig-CEDmL9ir.js} +2 -2
- package/dist/client/assets/{typescript-DoXLYiyl.js → typescript-B1NW_Svr.js} +2 -2
- package/dist/client/assets/{vue-DIv66ZbN.js → vue-CEjpLlUp.js} +2 -2
- package/dist/client/assets/{vue-html-DJnU3oci.js → vue-html-BLRayXbW.js} +2 -2
- package/dist/client/assets/{vue-vine-CnFyQ4Cm.js → vue-vine-BaZ_eWYq.js} +2 -2
- package/dist/client/assets/{xml-DflQf7I-.js → xml-WjUY_YSL.js} +2 -2
- package/dist/client/assets/{xsl-DegV0fmP.js → xsl-rMBkkP2N.js} +2 -2
- package/dist/client/assets/{yaml-CQI6ctBx.js → yaml-BVcdKGq_.js} +2 -2
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/arrow-right-B_11zHBP.js +0 -2
- package/dist/client/assets/textarea-DJbYd4DI.js +0 -46
package/dist/bin.mjs
CHANGED
|
@@ -233,7 +233,7 @@ const make$73 = () => {
|
|
|
233
233
|
const layer$69 = Layer.sync(NetService, make$73);
|
|
234
234
|
//#endregion
|
|
235
235
|
//#region package.json
|
|
236
|
-
var version = "0.1.
|
|
236
|
+
var version = "0.1.12";
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region src/config.ts
|
|
239
239
|
/**
|
|
@@ -1651,6 +1651,12 @@ const RuntimeMode = Schema$1.Literals([
|
|
|
1651
1651
|
const DEFAULT_RUNTIME_MODE$2 = "full-access";
|
|
1652
1652
|
const ProviderInteractionMode = Schema$1.Literals(["default", "plan"]);
|
|
1653
1653
|
const DEFAULT_PROVIDER_INTERACTION_MODE = "default";
|
|
1654
|
+
const CompressMode = Schema$1.Literals([
|
|
1655
|
+
"off",
|
|
1656
|
+
"lite",
|
|
1657
|
+
"full",
|
|
1658
|
+
"ultra"
|
|
1659
|
+
]);
|
|
1654
1660
|
const ProviderRequestKind = Schema$1.Literals([
|
|
1655
1661
|
"command",
|
|
1656
1662
|
"file-read",
|
|
@@ -1827,6 +1833,7 @@ const OrchestrationThread = Schema$1.Struct({
|
|
|
1827
1833
|
modelSelection: ModelSelection,
|
|
1828
1834
|
runtimeMode: RuntimeMode,
|
|
1829
1835
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
1836
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
1830
1837
|
branch: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1831
1838
|
worktreePath: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1832
1839
|
latestTurn: Schema$1.NullOr(OrchestrationLatestTurn),
|
|
@@ -1867,6 +1874,7 @@ const OrchestrationThreadShell = Schema$1.Struct({
|
|
|
1867
1874
|
modelSelection: ModelSelection,
|
|
1868
1875
|
runtimeMode: RuntimeMode,
|
|
1869
1876
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
1877
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
1870
1878
|
branch: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1871
1879
|
worktreePath: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1872
1880
|
latestTurn: Schema$1.NullOr(OrchestrationLatestTurn),
|
|
@@ -1989,6 +1997,7 @@ const ThreadCreateCommand = Schema$1.Struct({
|
|
|
1989
1997
|
modelSelection: ModelSelection,
|
|
1990
1998
|
runtimeMode: RuntimeMode,
|
|
1991
1999
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
2000
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
1992
2001
|
branch: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1993
2002
|
worktreePath: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
1994
2003
|
createdAt: IsoDateTime
|
|
@@ -2055,12 +2064,20 @@ const ThreadInteractionModeSetCommand = Schema$1.Struct({
|
|
|
2055
2064
|
interactionMode: ProviderInteractionMode,
|
|
2056
2065
|
createdAt: IsoDateTime
|
|
2057
2066
|
});
|
|
2067
|
+
const ThreadCompressModeSetCommand = Schema$1.Struct({
|
|
2068
|
+
type: Schema$1.Literal("thread.compress-mode.set"),
|
|
2069
|
+
commandId: CommandId,
|
|
2070
|
+
threadId: ThreadId,
|
|
2071
|
+
compressMode: CompressMode,
|
|
2072
|
+
createdAt: IsoDateTime
|
|
2073
|
+
});
|
|
2058
2074
|
const ThreadTurnStartBootstrapCreateThread = Schema$1.Struct({
|
|
2059
2075
|
projectId: ProjectId,
|
|
2060
2076
|
title: TrimmedNonEmptyString,
|
|
2061
2077
|
modelSelection: ModelSelection,
|
|
2062
2078
|
runtimeMode: RuntimeMode,
|
|
2063
2079
|
interactionMode: ProviderInteractionMode,
|
|
2080
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2064
2081
|
branch: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
2065
2082
|
worktreePath: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
2066
2083
|
createdAt: IsoDateTime
|
|
@@ -2090,6 +2107,7 @@ const ThreadTurnStartCommand = Schema$1.Struct({
|
|
|
2090
2107
|
titleSeed: Schema$1.optional(TrimmedNonEmptyString),
|
|
2091
2108
|
runtimeMode: RuntimeMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE$2))),
|
|
2092
2109
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
2110
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2093
2111
|
bootstrap: Schema$1.optional(ThreadTurnStartBootstrap),
|
|
2094
2112
|
sourceProposedPlan: Schema$1.optional(SourceProposedPlanReference),
|
|
2095
2113
|
createdAt: IsoDateTime
|
|
@@ -2108,6 +2126,7 @@ const ClientThreadTurnStartCommand = Schema$1.Struct({
|
|
|
2108
2126
|
titleSeed: Schema$1.optional(TrimmedNonEmptyString),
|
|
2109
2127
|
runtimeMode: RuntimeMode,
|
|
2110
2128
|
interactionMode: ProviderInteractionMode,
|
|
2129
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2111
2130
|
bootstrap: Schema$1.optional(ThreadTurnStartBootstrap),
|
|
2112
2131
|
sourceProposedPlan: Schema$1.optional(SourceProposedPlanReference),
|
|
2113
2132
|
createdAt: IsoDateTime
|
|
@@ -2163,6 +2182,7 @@ const DispatchableClientOrchestrationCommand = Schema$1.Union([
|
|
|
2163
2182
|
ThreadMetaUpdateCommand,
|
|
2164
2183
|
ThreadRuntimeModeSetCommand,
|
|
2165
2184
|
ThreadInteractionModeSetCommand,
|
|
2185
|
+
ThreadCompressModeSetCommand,
|
|
2166
2186
|
ThreadTurnStartCommand,
|
|
2167
2187
|
ThreadTurnInterruptCommand,
|
|
2168
2188
|
ThreadApprovalRespondCommand,
|
|
@@ -2185,6 +2205,7 @@ const ClientOrchestrationCommand = Schema$1.Union([
|
|
|
2185
2205
|
ThreadMetaUpdateCommand,
|
|
2186
2206
|
ThreadRuntimeModeSetCommand,
|
|
2187
2207
|
ThreadInteractionModeSetCommand,
|
|
2208
|
+
ThreadCompressModeSetCommand,
|
|
2188
2209
|
ClientThreadTurnStartCommand,
|
|
2189
2210
|
ThreadTurnInterruptCommand,
|
|
2190
2211
|
ThreadApprovalRespondCommand,
|
|
@@ -2275,6 +2296,7 @@ const OrchestrationEventType = Schema$1.Literals([
|
|
|
2275
2296
|
"thread.meta-updated",
|
|
2276
2297
|
"thread.runtime-mode-set",
|
|
2277
2298
|
"thread.interaction-mode-set",
|
|
2299
|
+
"thread.compress-mode-set",
|
|
2278
2300
|
"thread.message-sent",
|
|
2279
2301
|
"thread.turn-start-requested",
|
|
2280
2302
|
"thread.turn-interrupt-requested",
|
|
@@ -2324,6 +2346,7 @@ const ThreadCreatedPayload$1 = Schema$1.Struct({
|
|
|
2324
2346
|
modelSelection: ModelSelection,
|
|
2325
2347
|
runtimeMode: RuntimeMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE$2))),
|
|
2326
2348
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
2349
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2327
2350
|
branch: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
2328
2351
|
worktreePath: Schema$1.NullOr(TrimmedNonEmptyString),
|
|
2329
2352
|
createdAt: IsoDateTime,
|
|
@@ -2381,6 +2404,11 @@ const ThreadInteractionModeSetPayload$1 = Schema$1.Struct({
|
|
|
2381
2404
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
2382
2405
|
updatedAt: IsoDateTime
|
|
2383
2406
|
});
|
|
2407
|
+
const ThreadCompressModeSetPayload$1 = Schema$1.Struct({
|
|
2408
|
+
threadId: ThreadId,
|
|
2409
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2410
|
+
updatedAt: IsoDateTime
|
|
2411
|
+
});
|
|
2384
2412
|
const ThreadMessageSentPayload = Schema$1.Struct({
|
|
2385
2413
|
threadId: ThreadId,
|
|
2386
2414
|
messageId: MessageId,
|
|
@@ -2399,6 +2427,7 @@ const ThreadTurnStartRequestedPayload = Schema$1.Struct({
|
|
|
2399
2427
|
titleSeed: Schema$1.optional(TrimmedNonEmptyString),
|
|
2400
2428
|
runtimeMode: RuntimeMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE$2))),
|
|
2401
2429
|
interactionMode: ProviderInteractionMode.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE))),
|
|
2430
|
+
compressMode: CompressMode.pipe(Schema$1.withDecodingDefault(Effect.succeed("off"))),
|
|
2402
2431
|
sourceProposedPlan: Schema$1.optional(SourceProposedPlanReference),
|
|
2403
2432
|
createdAt: IsoDateTime
|
|
2404
2433
|
});
|
|
@@ -2543,6 +2572,11 @@ const OrchestrationEvent = Schema$1.Union([
|
|
|
2543
2572
|
type: Schema$1.Literal("thread.interaction-mode-set"),
|
|
2544
2573
|
payload: ThreadInteractionModeSetPayload$1
|
|
2545
2574
|
}),
|
|
2575
|
+
Schema$1.Struct({
|
|
2576
|
+
...EventBaseFields,
|
|
2577
|
+
type: Schema$1.Literal("thread.compress-mode-set"),
|
|
2578
|
+
payload: ThreadCompressModeSetPayload$1
|
|
2579
|
+
}),
|
|
2546
2580
|
Schema$1.Struct({
|
|
2547
2581
|
...EventBaseFields,
|
|
2548
2582
|
type: Schema$1.Literal("thread.message-sent"),
|
|
@@ -4518,14 +4552,16 @@ const ProviderSessionStartInput = Schema$1.Struct({
|
|
|
4518
4552
|
resumeCursor: Schema$1.optional(Schema$1.Unknown),
|
|
4519
4553
|
approvalPolicy: Schema$1.optional(ProviderApprovalPolicy),
|
|
4520
4554
|
sandboxMode: Schema$1.optional(ProviderSandboxMode),
|
|
4521
|
-
runtimeMode: RuntimeMode
|
|
4555
|
+
runtimeMode: RuntimeMode,
|
|
4556
|
+
compressMode: Schema$1.optional(CompressMode)
|
|
4522
4557
|
});
|
|
4523
4558
|
const ProviderSendTurnInput = Schema$1.Struct({
|
|
4524
4559
|
threadId: ThreadId,
|
|
4525
4560
|
input: Schema$1.optional(TrimmedNonEmptyString.check(Schema$1.isMaxLength(PROVIDER_SEND_TURN_MAX_INPUT_CHARS))),
|
|
4526
4561
|
attachments: Schema$1.optional(Schema$1.Array(ChatAttachment).check(Schema$1.isMaxLength(8))),
|
|
4527
4562
|
modelSelection: Schema$1.optional(ModelSelection),
|
|
4528
|
-
interactionMode: Schema$1.optional(ProviderInteractionMode)
|
|
4563
|
+
interactionMode: Schema$1.optional(ProviderInteractionMode),
|
|
4564
|
+
compressMode: Schema$1.optional(CompressMode)
|
|
4529
4565
|
});
|
|
4530
4566
|
Schema$1.Struct({
|
|
4531
4567
|
threadId: ThreadId,
|
|
@@ -7538,6 +7574,84 @@ var ProjectWriteFileError = class extends Schema$1.TaggedErrorClass()("ProjectWr
|
|
|
7538
7574
|
}
|
|
7539
7575
|
};
|
|
7540
7576
|
//#endregion
|
|
7577
|
+
//#region ../../packages/contracts/src/threadControl.ts
|
|
7578
|
+
/**
|
|
7579
|
+
* Thread control over MCP - the self-scoped toolkit an agent uses to act on
|
|
7580
|
+
* the thread it is running in.
|
|
7581
|
+
*
|
|
7582
|
+
* Deliberately narrow. The reported need was an agent renaming its own thread;
|
|
7583
|
+
* that needs no cross-thread reach, and the per-session bearer token is the
|
|
7584
|
+
* only thing guarding `/mcp` on a remote-reachable server, so a capability
|
|
7585
|
+
* that could rename arbitrary threads would be a capability to vandalise the
|
|
7586
|
+
* workspace from one leaked token. Delete and create are withheld outright,
|
|
7587
|
+
* the same answer the task toolkit gave. Settle is absent for a structural
|
|
7588
|
+
* reason rather than a policy one: the decider refuses `thread.settle` while
|
|
7589
|
+
* the thread's session is starting or running, and a self-scoped MCP call
|
|
7590
|
+
* always arrives from its own live session, so the call could never succeed.
|
|
7591
|
+
*
|
|
7592
|
+
* Quick-append to memory lives here too: it is the other thing an agent wants
|
|
7593
|
+
* to do *from* a thread, and it shares the toolkit's capability and scope.
|
|
7594
|
+
*
|
|
7595
|
+
* @module contracts/threadControl
|
|
7596
|
+
*/
|
|
7597
|
+
const ThreadRenameInput = Schema$1.Struct({ title: TrimmedNonEmptyString.annotate({ description: "The new thread title. Replaces the current one." }) });
|
|
7598
|
+
const ThreadRenameResult = Schema$1.Struct({
|
|
7599
|
+
threadId: ThreadId,
|
|
7600
|
+
title: TrimmedNonEmptyString
|
|
7601
|
+
});
|
|
7602
|
+
/**
|
|
7603
|
+
* Which memory file an append lands in.
|
|
7604
|
+
*
|
|
7605
|
+
* A closed union rather than a filename, because the target directory also
|
|
7606
|
+
* holds credentials and per-machine settings - the same reason the hub sync's
|
|
7607
|
+
* memory allowlist exists. These two names must stay within that allowlist
|
|
7608
|
+
* (`MEMORY_FILE_NAMES` in `sync/memoryFile.ts`), so an appended file is one
|
|
7609
|
+
* the sync will carry to the user's other machines rather than refuse.
|
|
7610
|
+
*/
|
|
7611
|
+
const MemoryAppendTarget = Schema$1.Literals(["CLAUDE.md", "AGENTS.md"]);
|
|
7612
|
+
const MemoryAppendInput = Schema$1.Struct({
|
|
7613
|
+
text: TrimmedNonEmptyString.annotate({ description: "Markdown to append to the user-scope memory file, as its own block." }),
|
|
7614
|
+
file: Schema$1.optional(MemoryAppendTarget.annotate({ description: "Which memory file to append to. Defaults to CLAUDE.md." }))
|
|
7615
|
+
});
|
|
7616
|
+
const MemoryAppendResult = Schema$1.Struct({
|
|
7617
|
+
file: MemoryAppendTarget,
|
|
7618
|
+
/** Absolute path the append landed in, so the agent can cite or inspect it. */
|
|
7619
|
+
path: Schema$1.String
|
|
7620
|
+
});
|
|
7621
|
+
var ThreadToolUnavailableError = class extends Schema$1.TaggedErrorClass()("ThreadToolUnavailableError", {
|
|
7622
|
+
capability: Schema$1.Literal("threads"),
|
|
7623
|
+
environmentId: EnvironmentId,
|
|
7624
|
+
threadId: ThreadId,
|
|
7625
|
+
providerSessionId: TrimmedNonEmptyString,
|
|
7626
|
+
providerInstanceId: ProviderInstanceId
|
|
7627
|
+
}) {
|
|
7628
|
+
get message() {
|
|
7629
|
+
return `MCP credential does not grant the ${this.capability} capability.`;
|
|
7630
|
+
}
|
|
7631
|
+
};
|
|
7632
|
+
/** The orchestration engine declined or failed the rename command. */
|
|
7633
|
+
var ThreadRenameRejectedError = class extends Schema$1.TaggedErrorClass()("ThreadRenameRejectedError", {
|
|
7634
|
+
threadId: ThreadId,
|
|
7635
|
+
detail: Schema$1.String
|
|
7636
|
+
}) {
|
|
7637
|
+
get message() {
|
|
7638
|
+
return `Renaming thread ${this.threadId} failed: ${this.detail}`;
|
|
7639
|
+
}
|
|
7640
|
+
};
|
|
7641
|
+
var MemoryAppendFailedError = class extends Schema$1.TaggedErrorClass()("MemoryAppendFailedError", {
|
|
7642
|
+
file: MemoryAppendTarget,
|
|
7643
|
+
detail: Schema$1.String
|
|
7644
|
+
}) {
|
|
7645
|
+
get message() {
|
|
7646
|
+
return `Appending to ${this.file} failed: ${this.detail}`;
|
|
7647
|
+
}
|
|
7648
|
+
};
|
|
7649
|
+
const ThreadControlToolError = Schema$1.Union([
|
|
7650
|
+
ThreadToolUnavailableError,
|
|
7651
|
+
ThreadRenameRejectedError,
|
|
7652
|
+
MemoryAppendFailedError
|
|
7653
|
+
]);
|
|
7654
|
+
//#endregion
|
|
7541
7655
|
//#region ../../packages/contracts/src/agentAsset.ts
|
|
7542
7656
|
/**
|
|
7543
7657
|
* User-scope agent assets — the things that make an agent behave the same on
|
|
@@ -12147,6 +12261,14 @@ var _038_TaskOrderKeys_default = Effect.gen(function* () {
|
|
|
12147
12261
|
yield* (yield* SqlClient.SqlClient)`ALTER TABLE tasks ADD COLUMN order_key TEXT`;
|
|
12148
12262
|
});
|
|
12149
12263
|
//#endregion
|
|
12264
|
+
//#region src/persistence/Migrations/039_ProjectionThreadsCompressMode.ts
|
|
12265
|
+
var _039_ProjectionThreadsCompressMode_default = Effect.gen(function* () {
|
|
12266
|
+
yield* (yield* SqlClient.SqlClient)`
|
|
12267
|
+
ALTER TABLE projection_threads
|
|
12268
|
+
ADD COLUMN compress_mode TEXT NOT NULL DEFAULT 'off'
|
|
12269
|
+
`;
|
|
12270
|
+
});
|
|
12271
|
+
//#endregion
|
|
12150
12272
|
//#region src/persistence/Migrations.ts
|
|
12151
12273
|
/**
|
|
12152
12274
|
* MigrationsLive - Migration runner with inline loader
|
|
@@ -12357,6 +12479,11 @@ const migrationEntries = [
|
|
|
12357
12479
|
38,
|
|
12358
12480
|
"TaskOrderKeys",
|
|
12359
12481
|
_038_TaskOrderKeys_default
|
|
12482
|
+
],
|
|
12483
|
+
[
|
|
12484
|
+
39,
|
|
12485
|
+
"ProjectionThreadsCompressMode",
|
|
12486
|
+
_039_ProjectionThreadsCompressMode_default
|
|
12360
12487
|
]
|
|
12361
12488
|
];
|
|
12362
12489
|
const makeMigrationLoader = (throughId) => Migrator.fromRecord(Object.fromEntries(migrationEntries.filter(([id]) => throughId === void 0 || id <= throughId).map(([id, name, migration]) => [`${id}_${name}`, migration])));
|
|
@@ -18053,6 +18180,7 @@ const ThreadSettledPayload = ThreadSettledPayload$1;
|
|
|
18053
18180
|
const ThreadMetaUpdatedPayload = ThreadMetaUpdatedPayload$1;
|
|
18054
18181
|
const ThreadRuntimeModeSetPayload = ThreadRuntimeModeSetPayload$1;
|
|
18055
18182
|
const ThreadInteractionModeSetPayload = ThreadInteractionModeSetPayload$1;
|
|
18183
|
+
const ThreadCompressModeSetPayload = ThreadCompressModeSetPayload$1;
|
|
18056
18184
|
const ThreadDeletedPayload = ThreadDeletedPayload$1;
|
|
18057
18185
|
const ThreadUnarchivedPayload = ThreadUnarchivedPayload$1;
|
|
18058
18186
|
const ThreadUnsettledPayload = ThreadUnsettledPayload$1;
|
|
@@ -18192,6 +18320,7 @@ function projectEvent(model, event) {
|
|
|
18192
18320
|
modelSelection: payload.modelSelection,
|
|
18193
18321
|
runtimeMode: payload.runtimeMode,
|
|
18194
18322
|
interactionMode: payload.interactionMode,
|
|
18323
|
+
compressMode: payload.compressMode,
|
|
18195
18324
|
branch: payload.branch,
|
|
18196
18325
|
worktreePath: payload.worktreePath,
|
|
18197
18326
|
latestTurn: null,
|
|
@@ -18291,6 +18420,13 @@ function projectEvent(model, event) {
|
|
|
18291
18420
|
updatedAt: payload.updatedAt
|
|
18292
18421
|
})
|
|
18293
18422
|
})));
|
|
18423
|
+
case "thread.compress-mode-set": return decodeForEvent(ThreadCompressModeSetPayload, event.payload, event.type, "payload").pipe(Effect.map((payload) => ({
|
|
18424
|
+
...nextBase,
|
|
18425
|
+
threads: updateThread(nextBase.threads, payload.threadId, {
|
|
18426
|
+
compressMode: payload.compressMode,
|
|
18427
|
+
updatedAt: payload.updatedAt
|
|
18428
|
+
})
|
|
18429
|
+
})));
|
|
18294
18430
|
case "thread.message-sent": return Effect.gen(function* () {
|
|
18295
18431
|
const payload = yield* decodeForEvent(MessageSentPayloadSchema, event.payload, event.type, "payload");
|
|
18296
18432
|
const thread = nextBase.threads.find((entry) => entry.id === payload.threadId);
|
|
@@ -18656,6 +18792,7 @@ const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand")(funct
|
|
|
18656
18792
|
modelSelection: command.modelSelection,
|
|
18657
18793
|
runtimeMode: command.runtimeMode,
|
|
18658
18794
|
interactionMode: command.interactionMode,
|
|
18795
|
+
compressMode: command.compressMode,
|
|
18659
18796
|
branch: command.branch,
|
|
18660
18797
|
worktreePath: command.worktreePath,
|
|
18661
18798
|
createdAt: command.createdAt,
|
|
@@ -18913,6 +19050,28 @@ const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand")(funct
|
|
|
18913
19050
|
}
|
|
18914
19051
|
};
|
|
18915
19052
|
}
|
|
19053
|
+
case "thread.compress-mode.set": {
|
|
19054
|
+
yield* requireThread({
|
|
19055
|
+
readModel,
|
|
19056
|
+
command,
|
|
19057
|
+
threadId: command.threadId
|
|
19058
|
+
});
|
|
19059
|
+
const occurredAt = yield* nowIso$8;
|
|
19060
|
+
return {
|
|
19061
|
+
...yield* withEventBase({
|
|
19062
|
+
aggregateKind: "thread",
|
|
19063
|
+
aggregateId: command.threadId,
|
|
19064
|
+
occurredAt,
|
|
19065
|
+
commandId: command.commandId
|
|
19066
|
+
}),
|
|
19067
|
+
type: "thread.compress-mode-set",
|
|
19068
|
+
payload: {
|
|
19069
|
+
threadId: command.threadId,
|
|
19070
|
+
compressMode: command.compressMode,
|
|
19071
|
+
updatedAt: occurredAt
|
|
19072
|
+
}
|
|
19073
|
+
};
|
|
19074
|
+
}
|
|
18916
19075
|
case "thread.turn.start": {
|
|
18917
19076
|
const targetThread = yield* requireThread({
|
|
18918
19077
|
readModel,
|
|
@@ -18970,6 +19129,7 @@ const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand")(funct
|
|
|
18970
19129
|
...command.titleSeed !== void 0 ? { titleSeed: command.titleSeed } : {},
|
|
18971
19130
|
runtimeMode: targetThread.runtimeMode,
|
|
18972
19131
|
interactionMode: targetThread.interactionMode,
|
|
19132
|
+
compressMode: targetThread.compressMode,
|
|
18973
19133
|
...sourceProposedPlan !== void 0 ? { sourceProposedPlan } : {},
|
|
18974
19134
|
createdAt: command.createdAt
|
|
18975
19135
|
}
|
|
@@ -19735,6 +19895,7 @@ const ProjectionThread = Schema$1.Struct({
|
|
|
19735
19895
|
modelSelection: ModelSelection,
|
|
19736
19896
|
runtimeMode: RuntimeMode,
|
|
19737
19897
|
interactionMode: ProviderInteractionMode,
|
|
19898
|
+
compressMode: CompressMode,
|
|
19738
19899
|
branch: Schema$1.NullOr(Schema$1.String),
|
|
19739
19900
|
worktreePath: Schema$1.NullOr(Schema$1.String),
|
|
19740
19901
|
latestTurnId: Schema$1.NullOr(TurnId),
|
|
@@ -20622,6 +20783,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
20622
20783
|
model_selection_json,
|
|
20623
20784
|
runtime_mode,
|
|
20624
20785
|
interaction_mode,
|
|
20786
|
+
compress_mode,
|
|
20625
20787
|
branch,
|
|
20626
20788
|
worktree_path,
|
|
20627
20789
|
latest_turn_id,
|
|
@@ -20645,6 +20807,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
20645
20807
|
${JSON.stringify(row.modelSelection)},
|
|
20646
20808
|
${row.runtimeMode},
|
|
20647
20809
|
${row.interactionMode},
|
|
20810
|
+
${row.compressMode},
|
|
20648
20811
|
${row.branch},
|
|
20649
20812
|
${row.worktreePath},
|
|
20650
20813
|
${row.latestTurnId},
|
|
@@ -20668,6 +20831,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
20668
20831
|
model_selection_json = excluded.model_selection_json,
|
|
20669
20832
|
runtime_mode = excluded.runtime_mode,
|
|
20670
20833
|
interaction_mode = excluded.interaction_mode,
|
|
20834
|
+
compress_mode = excluded.compress_mode,
|
|
20671
20835
|
branch = excluded.branch,
|
|
20672
20836
|
worktree_path = excluded.worktree_path,
|
|
20673
20837
|
latest_turn_id = excluded.latest_turn_id,
|
|
@@ -20696,6 +20860,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
20696
20860
|
model_selection_json AS "modelSelection",
|
|
20697
20861
|
runtime_mode AS "runtimeMode",
|
|
20698
20862
|
interaction_mode AS "interactionMode",
|
|
20863
|
+
compress_mode AS "compressMode",
|
|
20699
20864
|
branch,
|
|
20700
20865
|
worktree_path AS "worktreePath",
|
|
20701
20866
|
latest_turn_id AS "latestTurnId",
|
|
@@ -20726,6 +20891,7 @@ const makeProjectionThreadRepository = Effect.gen(function* () {
|
|
|
20726
20891
|
model_selection_json AS "modelSelection",
|
|
20727
20892
|
runtime_mode AS "runtimeMode",
|
|
20728
20893
|
interaction_mode AS "interactionMode",
|
|
20894
|
+
compress_mode AS "compressMode",
|
|
20729
20895
|
branch,
|
|
20730
20896
|
worktree_path AS "worktreePath",
|
|
20731
20897
|
latest_turn_id AS "latestTurnId",
|
|
@@ -21192,6 +21358,7 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
|
|
|
21192
21358
|
modelSelection: event.payload.modelSelection,
|
|
21193
21359
|
runtimeMode: event.payload.runtimeMode,
|
|
21194
21360
|
interactionMode: event.payload.interactionMode,
|
|
21361
|
+
compressMode: event.payload.compressMode,
|
|
21195
21362
|
branch: event.payload.branch,
|
|
21196
21363
|
worktreePath: event.payload.worktreePath,
|
|
21197
21364
|
latestTurnId: null,
|
|
@@ -21306,6 +21473,16 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
|
|
|
21306
21473
|
});
|
|
21307
21474
|
return;
|
|
21308
21475
|
}
|
|
21476
|
+
case "thread.compress-mode-set": {
|
|
21477
|
+
const existingRow = yield* projectionThreadRepository.getById({ threadId: event.payload.threadId });
|
|
21478
|
+
if (Option.isNone(existingRow)) return;
|
|
21479
|
+
yield* projectionThreadRepository.upsert({
|
|
21480
|
+
...existingRow.value,
|
|
21481
|
+
compressMode: event.payload.compressMode,
|
|
21482
|
+
updatedAt: event.payload.updatedAt
|
|
21483
|
+
});
|
|
21484
|
+
return;
|
|
21485
|
+
}
|
|
21309
21486
|
case "thread.deleted": {
|
|
21310
21487
|
attachmentSideEffects.deletedThreadIds.add(event.payload.threadId);
|
|
21311
21488
|
const existingRow = yield* projectionThreadRepository.getById({ threadId: event.payload.threadId });
|
|
@@ -22627,6 +22804,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
22627
22804
|
model_selection_json AS "modelSelection",
|
|
22628
22805
|
runtime_mode AS "runtimeMode",
|
|
22629
22806
|
interaction_mode AS "interactionMode",
|
|
22807
|
+
compress_mode AS "compressMode",
|
|
22630
22808
|
branch,
|
|
22631
22809
|
worktree_path AS "worktreePath",
|
|
22632
22810
|
latest_turn_id AS "latestTurnId",
|
|
@@ -22657,6 +22835,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
22657
22835
|
model_selection_json AS "modelSelection",
|
|
22658
22836
|
runtime_mode AS "runtimeMode",
|
|
22659
22837
|
interaction_mode AS "interactionMode",
|
|
22838
|
+
compress_mode AS "compressMode",
|
|
22660
22839
|
branch,
|
|
22661
22840
|
worktree_path AS "worktreePath",
|
|
22662
22841
|
latest_turn_id AS "latestTurnId",
|
|
@@ -22689,6 +22868,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
22689
22868
|
model_selection_json AS "modelSelection",
|
|
22690
22869
|
runtime_mode AS "runtimeMode",
|
|
22691
22870
|
interaction_mode AS "interactionMode",
|
|
22871
|
+
compress_mode AS "compressMode",
|
|
22692
22872
|
branch,
|
|
22693
22873
|
worktree_path AS "worktreePath",
|
|
22694
22874
|
latest_turn_id AS "latestTurnId",
|
|
@@ -23021,6 +23201,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23021
23201
|
model_selection_json AS "modelSelection",
|
|
23022
23202
|
runtime_mode AS "runtimeMode",
|
|
23023
23203
|
interaction_mode AS "interactionMode",
|
|
23204
|
+
compress_mode AS "compressMode",
|
|
23024
23205
|
branch,
|
|
23025
23206
|
worktree_path AS "worktreePath",
|
|
23026
23207
|
latest_turn_id AS "latestTurnId",
|
|
@@ -23322,6 +23503,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23322
23503
|
modelSelection: row.modelSelection,
|
|
23323
23504
|
runtimeMode: row.runtimeMode,
|
|
23324
23505
|
interactionMode: row.interactionMode,
|
|
23506
|
+
compressMode: row.compressMode,
|
|
23325
23507
|
branch: row.branch,
|
|
23326
23508
|
worktreePath: row.worktreePath,
|
|
23327
23509
|
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
|
@@ -23433,6 +23615,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23433
23615
|
modelSelection: row.modelSelection,
|
|
23434
23616
|
runtimeMode: row.runtimeMode,
|
|
23435
23617
|
interactionMode: row.interactionMode,
|
|
23618
|
+
compressMode: row.compressMode,
|
|
23436
23619
|
branch: row.branch,
|
|
23437
23620
|
worktreePath: row.worktreePath,
|
|
23438
23621
|
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
|
@@ -23491,6 +23674,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23491
23674
|
modelSelection: row.modelSelection,
|
|
23492
23675
|
runtimeMode: row.runtimeMode,
|
|
23493
23676
|
interactionMode: row.interactionMode,
|
|
23677
|
+
compressMode: row.compressMode,
|
|
23494
23678
|
branch: row.branch,
|
|
23495
23679
|
worktreePath: row.worktreePath,
|
|
23496
23680
|
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
|
@@ -23545,6 +23729,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23545
23729
|
modelSelection: row.modelSelection,
|
|
23546
23730
|
runtimeMode: row.runtimeMode,
|
|
23547
23731
|
interactionMode: row.interactionMode,
|
|
23732
|
+
compressMode: row.compressMode,
|
|
23548
23733
|
branch: row.branch,
|
|
23549
23734
|
worktreePath: row.worktreePath,
|
|
23550
23735
|
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
|
@@ -23635,6 +23820,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23635
23820
|
modelSelection: threadRow.value.modelSelection,
|
|
23636
23821
|
runtimeMode: threadRow.value.runtimeMode,
|
|
23637
23822
|
interactionMode: threadRow.value.interactionMode,
|
|
23823
|
+
compressMode: threadRow.value.compressMode,
|
|
23638
23824
|
branch: threadRow.value.branch,
|
|
23639
23825
|
worktreePath: threadRow.value.worktreePath,
|
|
23640
23826
|
latestTurn: Option.isSome(latestTurnRow) ? mapLatestTurn(latestTurnRow.value) : null,
|
|
@@ -23670,6 +23856,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
23670
23856
|
modelSelection: threadRow.value.modelSelection,
|
|
23671
23857
|
runtimeMode: threadRow.value.runtimeMode,
|
|
23672
23858
|
interactionMode: threadRow.value.interactionMode,
|
|
23859
|
+
compressMode: threadRow.value.compressMode,
|
|
23673
23860
|
branch: threadRow.value.branch,
|
|
23674
23861
|
worktreePath: threadRow.value.worktreePath,
|
|
23675
23862
|
latestTurn: Option.isSome(latestTurnRow) ? mapLatestTurn(latestTurnRow.value) : null,
|
|
@@ -27023,6 +27210,7 @@ const resolveAutoBootstrapWelcomeTargets = Effect.gen(function* () {
|
|
|
27023
27210
|
title: "New thread",
|
|
27024
27211
|
modelSelection: nextProjectDefaultModelSelection,
|
|
27025
27212
|
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
|
27213
|
+
compressMode: "off",
|
|
27026
27214
|
runtimeMode: "full-access",
|
|
27027
27215
|
branch: null,
|
|
27028
27216
|
worktreePath: null,
|
|
@@ -36040,6 +36228,18 @@ const requireTaskCapability = Effect.fn("mcp.requireTaskCapability")(function* (
|
|
|
36040
36228
|
});
|
|
36041
36229
|
return invocation;
|
|
36042
36230
|
});
|
|
36231
|
+
/** Third of the trio, for the same reason the second exists. */
|
|
36232
|
+
const requireThreadCapability = Effect.fn("mcp.requireThreadCapability")(function* () {
|
|
36233
|
+
const invocation = yield* McpInvocationContext;
|
|
36234
|
+
if (!invocation.capabilities.has("threads")) return yield* new ThreadToolUnavailableError({
|
|
36235
|
+
capability: "threads",
|
|
36236
|
+
environmentId: invocation.environmentId,
|
|
36237
|
+
threadId: invocation.threadId,
|
|
36238
|
+
providerSessionId: invocation.providerSessionId,
|
|
36239
|
+
providerInstanceId: invocation.providerInstanceId
|
|
36240
|
+
});
|
|
36241
|
+
return invocation;
|
|
36242
|
+
});
|
|
36043
36243
|
//#endregion
|
|
36044
36244
|
//#region src/mcp/PreviewAutomationBroker.ts
|
|
36045
36245
|
var PreviewAutomationBroker = class extends Context.Service()("@p4code/cli/mcp/PreviewAutomationBroker") {};
|
|
@@ -43431,6 +43631,7 @@ const makeWsRpcLayer = (currentSession, previewAutomationBroker) => WsRpcGroup.t
|
|
|
43431
43631
|
modelSelection: bootstrap.createThread.modelSelection,
|
|
43432
43632
|
runtimeMode: bootstrap.createThread.runtimeMode,
|
|
43433
43633
|
interactionMode: bootstrap.createThread.interactionMode,
|
|
43634
|
+
compressMode: bootstrap.createThread.compressMode,
|
|
43434
43635
|
branch: bootstrap.createThread.branch,
|
|
43435
43636
|
worktreePath: bootstrap.createThread.worktreePath,
|
|
43436
43637
|
createdAt: bootstrap.createThread.createdAt
|
|
@@ -43694,12 +43895,14 @@ const makeWsRpcLayer = (currentSession, previewAutomationBroker) => WsRpcGroup.t
|
|
|
43694
43895
|
titleSeed: threadTitle,
|
|
43695
43896
|
runtimeMode: DEFAULT_RUNTIME_MODE$2,
|
|
43696
43897
|
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
|
43898
|
+
compressMode: "off",
|
|
43697
43899
|
bootstrap: { createThread: {
|
|
43698
43900
|
projectId: plan.projectId,
|
|
43699
43901
|
title: threadTitle,
|
|
43700
43902
|
modelSelection,
|
|
43701
43903
|
runtimeMode: DEFAULT_RUNTIME_MODE$2,
|
|
43702
43904
|
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
|
43905
|
+
compressMode: "off",
|
|
43703
43906
|
branch: null,
|
|
43704
43907
|
worktreePath: null,
|
|
43705
43908
|
createdAt
|
|
@@ -44988,7 +45191,11 @@ const makeWithOptions = Effect.fn("McpSessionRegistry.make")(function* (options
|
|
|
44988
45191
|
threadId: ThreadId.make(request.threadId),
|
|
44989
45192
|
providerSessionId,
|
|
44990
45193
|
providerInstanceId: ProviderInstanceId.make(request.providerInstanceId),
|
|
44991
|
-
capabilities: /* @__PURE__ */ new Set([
|
|
45194
|
+
capabilities: /* @__PURE__ */ new Set([
|
|
45195
|
+
"preview",
|
|
45196
|
+
"tasks",
|
|
45197
|
+
"threads"
|
|
45198
|
+
]),
|
|
44992
45199
|
issuedAt
|
|
44993
45200
|
};
|
|
44994
45201
|
yield* SynchronizedRef.update(state, ({ records }) => {
|
|
@@ -47763,6 +47970,88 @@ function formatAskUserQuestionAnswers(answers) {
|
|
|
47763
47970
|
return formatted;
|
|
47764
47971
|
}
|
|
47765
47972
|
//#endregion
|
|
47973
|
+
//#region src/provider/CompressPrompts.ts
|
|
47974
|
+
/**
|
|
47975
|
+
* Caveman-style response compression rulesets, adapted from the caveman
|
|
47976
|
+
* plugin's SKILL.md. Pre-baked per level so injection is a lookup, not a
|
|
47977
|
+
* runtime template. Applies to assistant prose only: code blocks, commits,
|
|
47978
|
+
* PRs, error strings, and safety-critical text stay uncompressed.
|
|
47979
|
+
*/
|
|
47980
|
+
const COMPRESS_SHARED_RULES = `Respond terse. All technical substance stays. Only fluff dies.
|
|
47981
|
+
|
|
47982
|
+
## Persistence
|
|
47983
|
+
|
|
47984
|
+
Active every response. No revert after many turns. No filler drift. Still active if unsure.
|
|
47985
|
+
|
|
47986
|
+
## Rules
|
|
47987
|
+
|
|
47988
|
+
Drop filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Short synonyms (big not extensive, fix not "implement a solution for"). No tool-call narration, no decorative tables/emoji, no dumping long raw error logs unless asked - quote shortest decisive line. Standard well-known tech acronyms OK (DB/API/HTTP); never invent new abbreviations (cfg/impl/req/res/fn) - tokenizers split them same as the full word: zero tokens saved, reader still decodes. No causal arrows (->) in prose. Technical terms exact. Code blocks unchanged. Errors quoted exact.
|
|
47989
|
+
|
|
47990
|
+
Preserve the user's dominant language: compress the style, not the language. Always keep technical terms, code, API names, CLI commands, commit-type keywords (feat/fix/...), and exact error strings verbatim unless the user explicitly asks for translation.
|
|
47991
|
+
|
|
47992
|
+
No self-reference. Never name or announce the style. No compressed answer plus normal recap - compressed output only. Exception: user explicitly asks what the mode is.
|
|
47993
|
+
|
|
47994
|
+
## Auto-Clarity
|
|
47995
|
+
|
|
47996
|
+
Drop compression and write normally when:
|
|
47997
|
+
- Security warnings
|
|
47998
|
+
- Irreversible action confirmations
|
|
47999
|
+
- Multi-step sequences where fragment order or omitted conjunctions risk misread
|
|
48000
|
+
- Compression itself creates technical ambiguity
|
|
48001
|
+
- User asks to clarify or repeats a question
|
|
48002
|
+
|
|
48003
|
+
Resume compression after the clear part is done.
|
|
48004
|
+
|
|
48005
|
+
## Boundaries
|
|
48006
|
+
|
|
48007
|
+
Code, commit messages, and PR descriptions: write normal, uncompressed.`;
|
|
48008
|
+
const COMPRESS_RULESETS = {
|
|
48009
|
+
lite: `## Response compression: lite
|
|
48010
|
+
|
|
48011
|
+
${COMPRESS_SHARED_RULES}
|
|
48012
|
+
|
|
48013
|
+
## Intensity: lite
|
|
48014
|
+
|
|
48015
|
+
No filler or hedging. Keep articles and full sentences. Professional but tight.
|
|
48016
|
+
|
|
48017
|
+
Example - "Why does my React component re-render?"
|
|
48018
|
+
"Your component re-renders because you create a new object reference each render. Wrap it in \`useMemo\`."`,
|
|
48019
|
+
full: `## Response compression: full
|
|
48020
|
+
|
|
48021
|
+
${COMPRESS_SHARED_RULES}
|
|
48022
|
+
|
|
48023
|
+
## Intensity: full
|
|
48024
|
+
|
|
48025
|
+
Drop articles (a/an/the), fragments OK, short synonyms. Pattern: [thing] [action] [reason]. [next step].
|
|
48026
|
+
|
|
48027
|
+
Not: "Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by..."
|
|
48028
|
+
Yes: "Bug in auth middleware. Token expiry check use \`<\` not \`<=\`. Fix:"
|
|
48029
|
+
|
|
48030
|
+
Example - "Why does my React component re-render?"
|
|
48031
|
+
"New object ref each render. Inline object prop = new ref = re-render. Wrap in \`useMemo\`."`,
|
|
48032
|
+
ultra: `## Response compression: ultra
|
|
48033
|
+
|
|
48034
|
+
${COMPRESS_SHARED_RULES}
|
|
48035
|
+
|
|
48036
|
+
## Intensity: ultra
|
|
48037
|
+
|
|
48038
|
+
Drop articles, fragments OK, short synonyms. Also strip conjunctions when cause-then-effect stays unambiguous. One word when one word is enough. State each fact once. Code symbols, function names, API names, error strings: never touch.
|
|
48039
|
+
|
|
48040
|
+
Example - "Why does my React component re-render?"
|
|
48041
|
+
"Inline object prop, new ref, re-render. \`useMemo\`."`
|
|
48042
|
+
};
|
|
48043
|
+
const COMPRESS_TURN_REMINDERS = {
|
|
48044
|
+
lite: "[response style: compressed lite - no filler/hedging, full sentences; code/commits/security text normal]",
|
|
48045
|
+
full: "[response style: compressed full - terse fragments, drop articles/filler; code/commits/security text normal]",
|
|
48046
|
+
ultra: "[response style: compressed ultra - maximum terseness, one word when enough; code/commits/security text normal]"
|
|
48047
|
+
};
|
|
48048
|
+
function compressRulesetFor(mode) {
|
|
48049
|
+
return mode === "off" ? void 0 : COMPRESS_RULESETS[mode];
|
|
48050
|
+
}
|
|
48051
|
+
function compressTurnReminderFor(mode) {
|
|
48052
|
+
return mode === "off" ? void 0 : COMPRESS_TURN_REMINDERS[mode];
|
|
48053
|
+
}
|
|
48054
|
+
//#endregion
|
|
47766
48055
|
//#region src/provider/Layers/ClaudeAdapter.ts
|
|
47767
48056
|
/**
|
|
47768
48057
|
* ClaudeAdapterLive - Scoped live implementation for the Claude Agent provider adapter.
|
|
@@ -50152,6 +50441,8 @@ const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (claudeSettin
|
|
|
50152
50441
|
const mcpSession = readMcpProviderSession(input.threadId);
|
|
50153
50442
|
const externalMcpServers = options?.resolveMcpServers === void 0 ? {} : yield* options.resolveMcpServers;
|
|
50154
50443
|
const narrateBeforeTools = options?.resolveToolCallNarration === void 0 ? DEFAULT_SERVER_SETTINGS.enableToolCallNarration : yield* options.resolveToolCallNarration;
|
|
50444
|
+
const compressRuleset = compressRulesetFor(input.compressMode ?? "off");
|
|
50445
|
+
const systemPromptAppend = [...narrateBeforeTools ? [NARRATE_BEFORE_TOOLS_PROMPT] : [], ...compressRuleset !== void 0 ? [compressRuleset] : []].join("\n\n");
|
|
50155
50446
|
const queryOptions = {
|
|
50156
50447
|
...input.cwd ? { cwd: input.cwd } : {},
|
|
50157
50448
|
...apiModelId ? { model: apiModelId } : {},
|
|
@@ -50159,7 +50450,7 @@ const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (claudeSettin
|
|
|
50159
50450
|
systemPrompt: {
|
|
50160
50451
|
type: "preset",
|
|
50161
50452
|
preset: "claude_code",
|
|
50162
|
-
...
|
|
50453
|
+
...systemPromptAppend.length > 0 ? { append: systemPromptAppend } : {}
|
|
50163
50454
|
},
|
|
50164
50455
|
settingSources: [...CLAUDE_SETTING_SOURCES],
|
|
50165
50456
|
...effectiveEffort ? { effort: effectiveEffort } : {},
|
|
@@ -69469,8 +69760,12 @@ ${P4_CODE_BROWSER_TOOL_INSTRUCTIONS}
|
|
|
69469
69760
|
function toSingleLine(value) {
|
|
69470
69761
|
return value.replaceAll(/\s+/g, " ").trim();
|
|
69471
69762
|
}
|
|
69472
|
-
function buildCodexDeveloperInstructions(interactionMode, runtime) {
|
|
69473
|
-
|
|
69763
|
+
function buildCodexDeveloperInstructions(interactionMode, runtime, compressMode) {
|
|
69764
|
+
const base = interactionMode === "plan" ? CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS : CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS;
|
|
69765
|
+
const compressRuleset = compressRulesetFor(compressMode ?? "off");
|
|
69766
|
+
return `${base}${compressRuleset === void 0 ? "" : `
|
|
69767
|
+
|
|
69768
|
+
<response_style>${compressRuleset}</response_style>`}
|
|
69474
69769
|
|
|
69475
69770
|
<runtime_info>In case you're asked: you are running in P4Code through the Codex harness, as ${toSingleLine(runtime.model)} with ${toSingleLine(runtime.reasoningEffort)} reasoning effort. No need to mention this otherwise.</runtime_info>`;
|
|
69476
69771
|
}
|
|
@@ -69588,7 +69883,7 @@ function buildCodexCollaborationMode(input) {
|
|
|
69588
69883
|
developer_instructions: buildCodexDeveloperInstructions(input.interactionMode, {
|
|
69589
69884
|
model,
|
|
69590
69885
|
reasoningEffort
|
|
69591
|
-
})
|
|
69886
|
+
}, input.compressMode)
|
|
69592
69887
|
}
|
|
69593
69888
|
};
|
|
69594
69889
|
}
|
|
@@ -69602,6 +69897,7 @@ function buildTurnStartParams(input) {
|
|
|
69602
69897
|
const config = runtimeModeToThreadConfig(input.runtimeMode);
|
|
69603
69898
|
const collaborationMode = buildCodexCollaborationMode({
|
|
69604
69899
|
...input.interactionMode ? { interactionMode: input.interactionMode } : {},
|
|
69900
|
+
...input.compressMode ? { compressMode: input.compressMode } : {},
|
|
69605
69901
|
...input.model ? { model: input.model } : {},
|
|
69606
69902
|
...input.effort ? { effort: input.effort } : {}
|
|
69607
69903
|
});
|
|
@@ -70140,7 +70436,8 @@ const makeCodexSessionRuntime = (options) => Effect.gen(function* () {
|
|
|
70140
70436
|
...normalizedModel ? { model: normalizedModel } : {},
|
|
70141
70437
|
...input.serviceTier ? { serviceTier: input.serviceTier } : {},
|
|
70142
70438
|
...input.effort ? { effort: input.effort } : {},
|
|
70143
|
-
...input.interactionMode ? { interactionMode: input.interactionMode } : {}
|
|
70439
|
+
...input.interactionMode ? { interactionMode: input.interactionMode } : {},
|
|
70440
|
+
...input.compressMode ? { compressMode: input.compressMode } : {}
|
|
70144
70441
|
});
|
|
70145
70442
|
const rawResponse = yield* client.raw.request("turn/start", params);
|
|
70146
70443
|
const response = yield* decodeV2TurnStartResponse(rawResponse).pipe(Effect.mapError((error) => CodexAppServerProtocolParseError.fromSchemaError("decode-response-payload", error, { method: "turn/start" })));
|
|
@@ -71132,6 +71429,7 @@ const makeCodexAdapter = Effect.fn("makeCodexAdapter")(function* (codexConfig, o
|
|
|
71132
71429
|
...reasoningEffort ? { effort: reasoningEffort } : {},
|
|
71133
71430
|
...serviceTier ? { serviceTier } : {},
|
|
71134
71431
|
...input.interactionMode !== void 0 ? { interactionMode: input.interactionMode } : {},
|
|
71432
|
+
...input.compressMode !== void 0 ? { compressMode: input.compressMode } : {},
|
|
71135
71433
|
...codexAttachments.length > 0 ? { attachments: codexAttachments } : {}
|
|
71136
71434
|
}).pipe(Effect.mapError((cause) => mapCodexRuntimeError(input.threadId, "turn/start", cause)));
|
|
71137
71435
|
});
|
|
@@ -82011,7 +82309,7 @@ const invokeTargeted = (operation, input, timeoutMs) => {
|
|
|
82011
82309
|
const { tabId, ...operationInput } = input;
|
|
82012
82310
|
return invoke(operation, operationInput, timeoutMs, tabId);
|
|
82013
82311
|
};
|
|
82014
|
-
const handlers$
|
|
82312
|
+
const handlers$2 = {
|
|
82015
82313
|
preview_status: (input) => invokeTargeted("status", input ?? {}),
|
|
82016
82314
|
preview_open: (input) => invokeTargeted("open", normalizePreviewOpenInput(input)),
|
|
82017
82315
|
preview_navigate: (input) => invokeTargeted("navigate", input, input.timeoutMs),
|
|
@@ -82027,10 +82325,10 @@ const handlers$1 = {
|
|
|
82027
82325
|
preview_recording_start: (input) => invokeTargeted("recordingStart", input ?? {}),
|
|
82028
82326
|
preview_recording_stop: (input) => invokeTargeted("recordingStop", input ?? {})
|
|
82029
82327
|
};
|
|
82030
|
-
const { preview_snapshot, ...standardHandlers } = handlers$
|
|
82328
|
+
const { preview_snapshot, ...standardHandlers } = handlers$2;
|
|
82031
82329
|
const PreviewStandardToolkitHandlersLive = PreviewStandardToolkit.toLayer(standardHandlers);
|
|
82032
82330
|
const PreviewSnapshotToolkitHandlersLive = PreviewSnapshotToolkit.toLayer({ preview_snapshot });
|
|
82033
|
-
PreviewToolkit.toLayer(handlers$
|
|
82331
|
+
PreviewToolkit.toLayer(handlers$2);
|
|
82034
82332
|
//#endregion
|
|
82035
82333
|
//#region src/mcp/toolkits/tasks/tools.ts
|
|
82036
82334
|
const dependencies = [McpInvocationContext, TaskRepository];
|
|
@@ -82176,6 +82474,93 @@ const TaskToolkitHandlersLive = TaskToolkit.toLayer({
|
|
|
82176
82474
|
})
|
|
82177
82475
|
});
|
|
82178
82476
|
//#endregion
|
|
82477
|
+
//#region src/mcp/toolkits/threads/tools.ts
|
|
82478
|
+
/**
|
|
82479
|
+
* Self-scoped on purpose: neither tool takes a thread id. The thread acted on
|
|
82480
|
+
* is always the one in `McpInvocationScope`, exactly as `task_current` resolves
|
|
82481
|
+
* it, so a leaked per-session token cannot reach any other thread. Delete,
|
|
82482
|
+
* create and archive are deliberately not exposed; settle could never succeed
|
|
82483
|
+
* from here because the decider refuses it while the calling session is alive.
|
|
82484
|
+
*/
|
|
82485
|
+
const ThreadRenameTool = Tool.make("thread_rename", {
|
|
82486
|
+
description: "Rename this agent session's own thread. Use it when the seeded title no longer matches what the thread turned out to be about. Only the current thread can be renamed; no other thread is reachable.",
|
|
82487
|
+
parameters: ThreadRenameInput,
|
|
82488
|
+
success: ThreadRenameResult,
|
|
82489
|
+
failure: ThreadControlToolError,
|
|
82490
|
+
dependencies: [
|
|
82491
|
+
McpInvocationContext,
|
|
82492
|
+
OrchestrationEngineService,
|
|
82493
|
+
Crypto.Crypto
|
|
82494
|
+
]
|
|
82495
|
+
}).annotate(Tool.Title, "Rename this thread").annotate(Tool.Readonly, false).annotate(Tool.Destructive, false).annotate(Tool.Idempotent, true);
|
|
82496
|
+
const MemoryAppendTool = Tool.make("memory_append", {
|
|
82497
|
+
description: "Append a block of markdown to the user-scope memory file (CLAUDE.md by default, AGENTS.md on request). Use it to record a durable preference or fact the user asked to remember. Appends only - it never rewrites or removes existing memory.",
|
|
82498
|
+
parameters: MemoryAppendInput,
|
|
82499
|
+
success: MemoryAppendResult,
|
|
82500
|
+
failure: ThreadControlToolError,
|
|
82501
|
+
dependencies: [
|
|
82502
|
+
McpInvocationContext,
|
|
82503
|
+
ServerSettingsService,
|
|
82504
|
+
FileSystem.FileSystem,
|
|
82505
|
+
Path.Path
|
|
82506
|
+
]
|
|
82507
|
+
}).annotate(Tool.Title, "Append to memory").annotate(Tool.Readonly, false).annotate(Tool.Destructive, false).annotate(Tool.Idempotent, false);
|
|
82508
|
+
const ThreadToolkit = Toolkit.make(ThreadRenameTool, MemoryAppendTool);
|
|
82509
|
+
//#endregion
|
|
82510
|
+
//#region src/mcp/toolkits/threads/handlers.ts
|
|
82511
|
+
const DEFAULT_MEMORY_APPEND_TARGET = "CLAUDE.md";
|
|
82512
|
+
const ThreadToolkitHandlersLive = ThreadToolkit.toLayer({
|
|
82513
|
+
thread_rename: (input) => Effect.gen(function* () {
|
|
82514
|
+
const invocation = yield* requireThreadCapability();
|
|
82515
|
+
const engine = yield* OrchestrationEngineService;
|
|
82516
|
+
const crypto = yield* Crypto.Crypto;
|
|
82517
|
+
const commandId = CommandId.make(yield* crypto.randomUUIDv4.pipe(Effect.orDie));
|
|
82518
|
+
yield* engine.dispatch({
|
|
82519
|
+
type: "thread.meta.update",
|
|
82520
|
+
commandId,
|
|
82521
|
+
threadId: invocation.threadId,
|
|
82522
|
+
title: input.title
|
|
82523
|
+
}).pipe(Effect.mapError((cause) => new ThreadRenameRejectedError({
|
|
82524
|
+
threadId: invocation.threadId,
|
|
82525
|
+
detail: cause.message
|
|
82526
|
+
})));
|
|
82527
|
+
return {
|
|
82528
|
+
threadId: invocation.threadId,
|
|
82529
|
+
title: input.title
|
|
82530
|
+
};
|
|
82531
|
+
}),
|
|
82532
|
+
memory_append: (input) => Effect.gen(function* () {
|
|
82533
|
+
yield* requireThreadCapability();
|
|
82534
|
+
const file = input.file ?? DEFAULT_MEMORY_APPEND_TARGET;
|
|
82535
|
+
if (!isMemoryFileName(file)) return yield* new MemoryAppendFailedError({
|
|
82536
|
+
file,
|
|
82537
|
+
detail: `${file} is not an allowlisted memory file.`
|
|
82538
|
+
});
|
|
82539
|
+
const memoryRoot = yield* resolveClaudeConfigDirPath({ homePath: (yield* (yield* ServerSettingsService).getSettings.pipe(Effect.orElseSucceed(() => void 0)))?.providers.claudeAgent.homePath ?? "" }, process.env);
|
|
82540
|
+
const path = yield* Path.Path;
|
|
82541
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
82542
|
+
const filePath = path.join(memoryRoot, file);
|
|
82543
|
+
const existing = yield* fileSystem.readFileString(filePath).pipe(Effect.orElseSucceed(() => ""));
|
|
82544
|
+
const block = input.text.trim();
|
|
82545
|
+
const contents = existing.trim().length === 0 ? `${block}\n` : `${existing.trimEnd()}\n\n${block}\n`;
|
|
82546
|
+
if (contents.length > 524288) return yield* new MemoryAppendFailedError({
|
|
82547
|
+
file,
|
|
82548
|
+
detail: `Appending would grow ${file} past ${AGENT_ASSET_FILE_MAX_CHARS} characters.`
|
|
82549
|
+
});
|
|
82550
|
+
yield* writeFileStringAtomically({
|
|
82551
|
+
filePath,
|
|
82552
|
+
contents
|
|
82553
|
+
}).pipe(Effect.mapError((cause) => new MemoryAppendFailedError({
|
|
82554
|
+
file,
|
|
82555
|
+
detail: cause.message
|
|
82556
|
+
})));
|
|
82557
|
+
return {
|
|
82558
|
+
file,
|
|
82559
|
+
path: filePath
|
|
82560
|
+
};
|
|
82561
|
+
})
|
|
82562
|
+
});
|
|
82563
|
+
//#endregion
|
|
82179
82564
|
//#region src/mcp/McpHttpServer.ts
|
|
82180
82565
|
const unauthorized = HttpServerResponse.jsonUnsafe({
|
|
82181
82566
|
error: "invalid_mcp_credential",
|
|
@@ -82279,12 +82664,13 @@ const PreviewStandardToolkitRegistrationLive = McpServer.toolkit(PreviewStandard
|
|
|
82279
82664
|
const PreviewSnapshotRegistrationLive = Layer.effectDiscard(registerPreviewSnapshot()).pipe(Layer.provide(PreviewSnapshotToolkitHandlersLive));
|
|
82280
82665
|
const PreviewToolkitRegistrationLive = Layer.mergeAll(PreviewStandardToolkitRegistrationLive, PreviewSnapshotRegistrationLive);
|
|
82281
82666
|
const TaskToolkitRegistrationLive = McpServer.toolkit(TaskToolkit).pipe(Layer.provide(TaskToolkitHandlersLive));
|
|
82667
|
+
const ThreadToolkitRegistrationLive = McpServer.toolkit(ThreadToolkit).pipe(Layer.provide(ThreadToolkitHandlersLive));
|
|
82282
82668
|
const McpTransportLive = McpServer.layerHttp({
|
|
82283
82669
|
name: "P4Code",
|
|
82284
82670
|
version,
|
|
82285
82671
|
path: "/mcp"
|
|
82286
82672
|
}).pipe(Layer.provide(McpAuthMiddlewareLive));
|
|
82287
|
-
const layer = Layer.mergeAll(PreviewToolkitRegistrationLive, TaskToolkitRegistrationLive).pipe(Layer.provideMerge(McpTransportLive));
|
|
82673
|
+
const layer = Layer.mergeAll(PreviewToolkitRegistrationLive, TaskToolkitRegistrationLive, ThreadToolkitRegistrationLive).pipe(Layer.provideMerge(McpTransportLive));
|
|
82288
82674
|
//#endregion
|
|
82289
82675
|
//#region src/orchestration/Services/CheckpointReactor.ts
|
|
82290
82676
|
/**
|
|
@@ -83695,7 +84081,8 @@ const make$2 = Effect.gen(function* () {
|
|
|
83695
84081
|
...effectiveCwd ? { cwd: effectiveCwd } : {},
|
|
83696
84082
|
modelSelection: desiredModelSelection,
|
|
83697
84083
|
...input?.resumeCursor !== void 0 ? { resumeCursor: input.resumeCursor } : {},
|
|
83698
|
-
runtimeMode: desiredRuntimeMode
|
|
84084
|
+
runtimeMode: desiredRuntimeMode,
|
|
84085
|
+
compressMode: thread.compressMode
|
|
83699
84086
|
});
|
|
83700
84087
|
const bindSessionToThread = (session) => Effect.gen(function* () {
|
|
83701
84088
|
if (session.providerInstanceId === void 0) return yield* new ProviderAdapterRequestError({
|
|
@@ -83768,6 +84155,7 @@ const make$2 = Effect.gen(function* () {
|
|
|
83768
84155
|
const buildSendTurnRequestForThread = Effect.fnUntraced(function* (input) {
|
|
83769
84156
|
const thread = yield* resolveThread(input.threadId);
|
|
83770
84157
|
if (!thread) return yield* Effect.die(/* @__PURE__ */ new Error(`Thread '${input.threadId}' was not found in read model.`));
|
|
84158
|
+
const hadActiveSession = thread.session !== null && thread.session.status !== "stopped";
|
|
83771
84159
|
yield* ensureSessionForThread(input.threadId, input.createdAt, {
|
|
83772
84160
|
...input.modelSelection !== void 0 ? { modelSelection: input.modelSelection } : {},
|
|
83773
84161
|
pendingTurnStart: true
|
|
@@ -83786,12 +84174,17 @@ const make$2 = Effect.gen(function* () {
|
|
|
83786
84174
|
...requestedModelSelection,
|
|
83787
84175
|
model: activeSession.model
|
|
83788
84176
|
} : requestedModelSelection : input.modelSelection;
|
|
84177
|
+
const compressMode = thread.compressMode;
|
|
84178
|
+
const hasSessionLevelRuleset = activeSession?.provider === "claudeAgent" || activeSession?.provider === "codex";
|
|
84179
|
+
const compressPrefix = !hadActiveSession && !hasSessionLevelRuleset ? compressRulesetFor(compressMode) : compressTurnReminderFor(compressMode);
|
|
84180
|
+
const inputWithCompressPrefix = normalizedInput !== void 0 && compressPrefix !== void 0 ? `${compressPrefix}\n\n${normalizedInput}` : normalizedInput;
|
|
83789
84181
|
return {
|
|
83790
84182
|
threadId: input.threadId,
|
|
83791
|
-
...
|
|
84183
|
+
...inputWithCompressPrefix ? { input: inputWithCompressPrefix } : {},
|
|
83792
84184
|
...normalizedAttachments.length > 0 ? { attachments: normalizedAttachments } : {},
|
|
83793
84185
|
...modelForTurn !== void 0 ? { modelSelection: modelForTurn } : {},
|
|
83794
|
-
...input.interactionMode !== void 0 ? { interactionMode: input.interactionMode } : {}
|
|
84186
|
+
...input.interactionMode !== void 0 ? { interactionMode: input.interactionMode } : {},
|
|
84187
|
+
compressMode
|
|
83795
84188
|
};
|
|
83796
84189
|
});
|
|
83797
84190
|
const maybeGenerateAndRenameWorktreeBranchForFirstTurn = Effect.fn("maybeGenerateAndRenameWorktreeBranchForFirstTurn")(function* (input) {
|