@cydm/pie 4.3.5 → 4.3.7
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/builtin/extensions/ask-user/index.js +4 -4
- package/dist/builtin/extensions/cron/index.js +7 -1
- package/dist/builtin/extensions/im-forward/index.js +101 -83
- package/dist/builtin/extensions/mcp-adapter/index.js +7 -1
- package/dist/builtin/extensions/memory/index.js +5 -5
- package/dist/builtin/extensions/pie-ipc/index.js +1 -1
- package/dist/builtin/extensions/pie-proc/index.js +3 -2
- package/dist/builtin/extensions/plan-mode/index.js +4 -4
- package/dist/builtin/extensions/subagent/index.js +5 -5
- package/dist/builtin/extensions/todo/index.js +4 -4
- package/dist/chunks/{chunk-J2LGVYH2.js → chunk-2SAFRLFJ.js} +28 -13
- package/dist/chunks/{chunk-JQRZLVPY.js → chunk-6JEYRAQM.js} +1898 -1692
- package/dist/chunks/{chunk-NCP264ZE.js → chunk-B4N5LJMD.js} +1 -1
- package/dist/chunks/{chunk-PFXSA2LK.js → chunk-BJ4XN5VX.js} +5 -5
- package/dist/chunks/{chunk-H5G55G3R.js → chunk-N3BWFAMZ.js} +11 -1
- package/dist/chunks/{chunk-QX6WS73C.js → chunk-VHKMWOG3.js} +1 -1
- package/dist/chunks/{chunk-PC6HUZAD.js → chunk-WZLO5V2X.js} +3 -3
- package/dist/chunks/{chunk-BK36Y35W.js → chunk-XMOWWL4B.js} +2 -2
- package/dist/chunks/{concierge-cli-MCHXTFBA.js → manager-cli-QNMCCIFG.js} +322 -44
- package/dist/chunks/{model-registry-YA6U366L.js → model-registry-NKE3BRSZ.js} +2 -2
- package/dist/chunks/{src-ODLT57PQ.js → src-46R5ZFOU.js} +2 -2
- package/dist/chunks/{src-VPMIQGEW.js → src-4EQ7PBEI.js} +3 -3
- package/dist/chunks/{src-XSLD2IQ2.js → src-BHIH4VLE.js} +1 -1
- package/dist/chunks/{src-AQ4H43UM.js → src-UVULNQOO.js} +4 -4
- package/dist/chunks/{test-stream-GIUD5JWS.js → test-stream-FC6ZRENI.js} +1 -1
- package/dist/cli.js +347 -208
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunks/chunk-6DNYGVZP.js";
|
|
7
7
|
import {
|
|
8
8
|
ModelRegistry
|
|
9
|
-
} from "./chunks/chunk-
|
|
9
|
+
} from "./chunks/chunk-VHKMWOG3.js";
|
|
10
10
|
import {
|
|
11
11
|
distillWorkerLogPath,
|
|
12
12
|
readDistillWorkerLog,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runDistillWorkerMain,
|
|
15
15
|
spawnDistillAutoWorker,
|
|
16
16
|
spawnDistillWorker
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-BJ4XN5VX.js";
|
|
18
18
|
import {
|
|
19
19
|
CLI_RETRY_MAX_RETRIES,
|
|
20
20
|
classifyCliFailure,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
logTransportLifecycle,
|
|
32
32
|
setYoloGrantListener,
|
|
33
33
|
truncateHeadTail
|
|
34
|
-
} from "./chunks/chunk-
|
|
34
|
+
} from "./chunks/chunk-2SAFRLFJ.js";
|
|
35
35
|
import {
|
|
36
36
|
VERSION,
|
|
37
37
|
getAgentDir,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
shouldPreserveExecutionStateForUserText,
|
|
77
77
|
supersedeExecutionState,
|
|
78
78
|
todayKey
|
|
79
|
-
} from "./chunks/chunk-
|
|
79
|
+
} from "./chunks/chunk-WZLO5V2X.js";
|
|
80
80
|
import {
|
|
81
81
|
AGENTS_CONTEXT_FILE_NAME,
|
|
82
82
|
AgentSessionController,
|
|
@@ -116,8 +116,8 @@ import {
|
|
|
116
116
|
setEnablementInMap,
|
|
117
117
|
setExtensionEnabledInSettings,
|
|
118
118
|
verifyPreparedCompactionCommit
|
|
119
|
-
} from "./chunks/chunk-
|
|
120
|
-
import "./chunks/chunk-
|
|
119
|
+
} from "./chunks/chunk-XMOWWL4B.js";
|
|
120
|
+
import "./chunks/chunk-B4N5LJMD.js";
|
|
121
121
|
import {
|
|
122
122
|
Deref,
|
|
123
123
|
Errors,
|
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
setLogger,
|
|
137
137
|
streamSimple,
|
|
138
138
|
type_exports
|
|
139
|
-
} from "./chunks/chunk-
|
|
139
|
+
} from "./chunks/chunk-6JEYRAQM.js";
|
|
140
140
|
import {
|
|
141
141
|
readImageFormat
|
|
142
142
|
} from "./chunks/chunk-F7EBZTZO.js";
|
|
@@ -1033,15 +1033,15 @@ var require_route = __commonJS({
|
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
1035
|
function wrapConversion(toModel, graph) {
|
|
1036
|
-
const
|
|
1036
|
+
const path35 = [graph[toModel].parent, toModel];
|
|
1037
1037
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
1038
1038
|
let cur = graph[toModel].parent;
|
|
1039
1039
|
while (graph[cur].parent) {
|
|
1040
|
-
|
|
1040
|
+
path35.unshift(graph[cur].parent);
|
|
1041
1041
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
1042
1042
|
cur = graph[cur].parent;
|
|
1043
1043
|
}
|
|
1044
|
-
fn.conversion =
|
|
1044
|
+
fn.conversion = path35;
|
|
1045
1045
|
return fn;
|
|
1046
1046
|
}
|
|
1047
1047
|
module.exports = function(fromModel) {
|
|
@@ -1964,7 +1964,7 @@ var require_core = __commonJS({
|
|
|
1964
1964
|
return match && match.index === 0;
|
|
1965
1965
|
}
|
|
1966
1966
|
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
1967
|
-
function
|
|
1967
|
+
function join24(regexps, separator = "|") {
|
|
1968
1968
|
let numCaptures = 0;
|
|
1969
1969
|
return regexps.map((regex) => {
|
|
1970
1970
|
numCaptures += 1;
|
|
@@ -2268,7 +2268,7 @@ var require_core = __commonJS({
|
|
|
2268
2268
|
this.exec = () => null;
|
|
2269
2269
|
}
|
|
2270
2270
|
const terminators = this.regexes.map((el) => el[1]);
|
|
2271
|
-
this.matcherRe = langRe(
|
|
2271
|
+
this.matcherRe = langRe(join24(terminators), true);
|
|
2272
2272
|
this.lastIndex = 0;
|
|
2273
2273
|
}
|
|
2274
2274
|
/** @param {string} s */
|
|
@@ -44081,17 +44081,17 @@ var require_visit = __commonJS({
|
|
|
44081
44081
|
visit.BREAK = BREAK;
|
|
44082
44082
|
visit.SKIP = SKIP;
|
|
44083
44083
|
visit.REMOVE = REMOVE;
|
|
44084
|
-
function visit_(key, node, visitor,
|
|
44085
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
44084
|
+
function visit_(key, node, visitor, path35) {
|
|
44085
|
+
const ctrl = callVisitor(key, node, visitor, path35);
|
|
44086
44086
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
44087
|
-
replaceNode(key,
|
|
44088
|
-
return visit_(key, ctrl, visitor,
|
|
44087
|
+
replaceNode(key, path35, ctrl);
|
|
44088
|
+
return visit_(key, ctrl, visitor, path35);
|
|
44089
44089
|
}
|
|
44090
44090
|
if (typeof ctrl !== "symbol") {
|
|
44091
44091
|
if (identity.isCollection(node)) {
|
|
44092
|
-
|
|
44092
|
+
path35 = Object.freeze(path35.concat(node));
|
|
44093
44093
|
for (let i = 0; i < node.items.length; ++i) {
|
|
44094
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
44094
|
+
const ci = visit_(i, node.items[i], visitor, path35);
|
|
44095
44095
|
if (typeof ci === "number")
|
|
44096
44096
|
i = ci - 1;
|
|
44097
44097
|
else if (ci === BREAK)
|
|
@@ -44102,13 +44102,13 @@ var require_visit = __commonJS({
|
|
|
44102
44102
|
}
|
|
44103
44103
|
}
|
|
44104
44104
|
} else if (identity.isPair(node)) {
|
|
44105
|
-
|
|
44106
|
-
const ck = visit_("key", node.key, visitor,
|
|
44105
|
+
path35 = Object.freeze(path35.concat(node));
|
|
44106
|
+
const ck = visit_("key", node.key, visitor, path35);
|
|
44107
44107
|
if (ck === BREAK)
|
|
44108
44108
|
return BREAK;
|
|
44109
44109
|
else if (ck === REMOVE)
|
|
44110
44110
|
node.key = null;
|
|
44111
|
-
const cv = visit_("value", node.value, visitor,
|
|
44111
|
+
const cv = visit_("value", node.value, visitor, path35);
|
|
44112
44112
|
if (cv === BREAK)
|
|
44113
44113
|
return BREAK;
|
|
44114
44114
|
else if (cv === REMOVE)
|
|
@@ -44129,17 +44129,17 @@ var require_visit = __commonJS({
|
|
|
44129
44129
|
visitAsync.BREAK = BREAK;
|
|
44130
44130
|
visitAsync.SKIP = SKIP;
|
|
44131
44131
|
visitAsync.REMOVE = REMOVE;
|
|
44132
|
-
async function visitAsync_(key, node, visitor,
|
|
44133
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
44132
|
+
async function visitAsync_(key, node, visitor, path35) {
|
|
44133
|
+
const ctrl = await callVisitor(key, node, visitor, path35);
|
|
44134
44134
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
44135
|
-
replaceNode(key,
|
|
44136
|
-
return visitAsync_(key, ctrl, visitor,
|
|
44135
|
+
replaceNode(key, path35, ctrl);
|
|
44136
|
+
return visitAsync_(key, ctrl, visitor, path35);
|
|
44137
44137
|
}
|
|
44138
44138
|
if (typeof ctrl !== "symbol") {
|
|
44139
44139
|
if (identity.isCollection(node)) {
|
|
44140
|
-
|
|
44140
|
+
path35 = Object.freeze(path35.concat(node));
|
|
44141
44141
|
for (let i = 0; i < node.items.length; ++i) {
|
|
44142
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
44142
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path35);
|
|
44143
44143
|
if (typeof ci === "number")
|
|
44144
44144
|
i = ci - 1;
|
|
44145
44145
|
else if (ci === BREAK)
|
|
@@ -44150,13 +44150,13 @@ var require_visit = __commonJS({
|
|
|
44150
44150
|
}
|
|
44151
44151
|
}
|
|
44152
44152
|
} else if (identity.isPair(node)) {
|
|
44153
|
-
|
|
44154
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
44153
|
+
path35 = Object.freeze(path35.concat(node));
|
|
44154
|
+
const ck = await visitAsync_("key", node.key, visitor, path35);
|
|
44155
44155
|
if (ck === BREAK)
|
|
44156
44156
|
return BREAK;
|
|
44157
44157
|
else if (ck === REMOVE)
|
|
44158
44158
|
node.key = null;
|
|
44159
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
44159
|
+
const cv = await visitAsync_("value", node.value, visitor, path35);
|
|
44160
44160
|
if (cv === BREAK)
|
|
44161
44161
|
return BREAK;
|
|
44162
44162
|
else if (cv === REMOVE)
|
|
@@ -44183,23 +44183,23 @@ var require_visit = __commonJS({
|
|
|
44183
44183
|
}
|
|
44184
44184
|
return visitor;
|
|
44185
44185
|
}
|
|
44186
|
-
function callVisitor(key, node, visitor,
|
|
44186
|
+
function callVisitor(key, node, visitor, path35) {
|
|
44187
44187
|
if (typeof visitor === "function")
|
|
44188
|
-
return visitor(key, node,
|
|
44188
|
+
return visitor(key, node, path35);
|
|
44189
44189
|
if (identity.isMap(node))
|
|
44190
|
-
return visitor.Map?.(key, node,
|
|
44190
|
+
return visitor.Map?.(key, node, path35);
|
|
44191
44191
|
if (identity.isSeq(node))
|
|
44192
|
-
return visitor.Seq?.(key, node,
|
|
44192
|
+
return visitor.Seq?.(key, node, path35);
|
|
44193
44193
|
if (identity.isPair(node))
|
|
44194
|
-
return visitor.Pair?.(key, node,
|
|
44194
|
+
return visitor.Pair?.(key, node, path35);
|
|
44195
44195
|
if (identity.isScalar(node))
|
|
44196
|
-
return visitor.Scalar?.(key, node,
|
|
44196
|
+
return visitor.Scalar?.(key, node, path35);
|
|
44197
44197
|
if (identity.isAlias(node))
|
|
44198
|
-
return visitor.Alias?.(key, node,
|
|
44198
|
+
return visitor.Alias?.(key, node, path35);
|
|
44199
44199
|
return void 0;
|
|
44200
44200
|
}
|
|
44201
|
-
function replaceNode(key,
|
|
44202
|
-
const parent =
|
|
44201
|
+
function replaceNode(key, path35, node) {
|
|
44202
|
+
const parent = path35[path35.length - 1];
|
|
44203
44203
|
if (identity.isCollection(parent)) {
|
|
44204
44204
|
parent.items[key] = node;
|
|
44205
44205
|
} else if (identity.isPair(parent)) {
|
|
@@ -44807,10 +44807,10 @@ var require_Collection = __commonJS({
|
|
|
44807
44807
|
var createNode = require_createNode();
|
|
44808
44808
|
var identity = require_identity();
|
|
44809
44809
|
var Node = require_Node();
|
|
44810
|
-
function collectionFromPath(schema,
|
|
44810
|
+
function collectionFromPath(schema, path35, value) {
|
|
44811
44811
|
let v2 = value;
|
|
44812
|
-
for (let i =
|
|
44813
|
-
const k2 =
|
|
44812
|
+
for (let i = path35.length - 1; i >= 0; --i) {
|
|
44813
|
+
const k2 = path35[i];
|
|
44814
44814
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
44815
44815
|
const a = [];
|
|
44816
44816
|
a[k2] = v2;
|
|
@@ -44829,7 +44829,7 @@ var require_Collection = __commonJS({
|
|
|
44829
44829
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
44830
44830
|
});
|
|
44831
44831
|
}
|
|
44832
|
-
var isEmptyPath = (
|
|
44832
|
+
var isEmptyPath = (path35) => path35 == null || typeof path35 === "object" && !!path35[Symbol.iterator]().next().done;
|
|
44833
44833
|
var Collection = class extends Node.NodeBase {
|
|
44834
44834
|
constructor(type, schema) {
|
|
44835
44835
|
super(type);
|
|
@@ -44859,11 +44859,11 @@ var require_Collection = __commonJS({
|
|
|
44859
44859
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
44860
44860
|
* that already exists in the map.
|
|
44861
44861
|
*/
|
|
44862
|
-
addIn(
|
|
44863
|
-
if (isEmptyPath(
|
|
44862
|
+
addIn(path35, value) {
|
|
44863
|
+
if (isEmptyPath(path35))
|
|
44864
44864
|
this.add(value);
|
|
44865
44865
|
else {
|
|
44866
|
-
const [key, ...rest] =
|
|
44866
|
+
const [key, ...rest] = path35;
|
|
44867
44867
|
const node = this.get(key, true);
|
|
44868
44868
|
if (identity.isCollection(node))
|
|
44869
44869
|
node.addIn(rest, value);
|
|
@@ -44877,8 +44877,8 @@ var require_Collection = __commonJS({
|
|
|
44877
44877
|
* Removes a value from the collection.
|
|
44878
44878
|
* @returns `true` if the item was found and removed.
|
|
44879
44879
|
*/
|
|
44880
|
-
deleteIn(
|
|
44881
|
-
const [key, ...rest] =
|
|
44880
|
+
deleteIn(path35) {
|
|
44881
|
+
const [key, ...rest] = path35;
|
|
44882
44882
|
if (rest.length === 0)
|
|
44883
44883
|
return this.delete(key);
|
|
44884
44884
|
const node = this.get(key, true);
|
|
@@ -44892,8 +44892,8 @@ var require_Collection = __commonJS({
|
|
|
44892
44892
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
44893
44893
|
* `true` (collections are always returned intact).
|
|
44894
44894
|
*/
|
|
44895
|
-
getIn(
|
|
44896
|
-
const [key, ...rest] =
|
|
44895
|
+
getIn(path35, keepScalar) {
|
|
44896
|
+
const [key, ...rest] = path35;
|
|
44897
44897
|
const node = this.get(key, true);
|
|
44898
44898
|
if (rest.length === 0)
|
|
44899
44899
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -44911,8 +44911,8 @@ var require_Collection = __commonJS({
|
|
|
44911
44911
|
/**
|
|
44912
44912
|
* Checks if the collection includes a value with the key `key`.
|
|
44913
44913
|
*/
|
|
44914
|
-
hasIn(
|
|
44915
|
-
const [key, ...rest] =
|
|
44914
|
+
hasIn(path35) {
|
|
44915
|
+
const [key, ...rest] = path35;
|
|
44916
44916
|
if (rest.length === 0)
|
|
44917
44917
|
return this.has(key);
|
|
44918
44918
|
const node = this.get(key, true);
|
|
@@ -44922,8 +44922,8 @@ var require_Collection = __commonJS({
|
|
|
44922
44922
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
44923
44923
|
* boolean to add/remove the item from the set.
|
|
44924
44924
|
*/
|
|
44925
|
-
setIn(
|
|
44926
|
-
const [key, ...rest] =
|
|
44925
|
+
setIn(path35, value) {
|
|
44926
|
+
const [key, ...rest] = path35;
|
|
44927
44927
|
if (rest.length === 0) {
|
|
44928
44928
|
this.set(key, value);
|
|
44929
44929
|
} else {
|
|
@@ -47435,9 +47435,9 @@ var require_Document = __commonJS({
|
|
|
47435
47435
|
this.contents.add(value);
|
|
47436
47436
|
}
|
|
47437
47437
|
/** Adds a value to the document. */
|
|
47438
|
-
addIn(
|
|
47438
|
+
addIn(path35, value) {
|
|
47439
47439
|
if (assertCollection(this.contents))
|
|
47440
|
-
this.contents.addIn(
|
|
47440
|
+
this.contents.addIn(path35, value);
|
|
47441
47441
|
}
|
|
47442
47442
|
/**
|
|
47443
47443
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -47512,14 +47512,14 @@ var require_Document = __commonJS({
|
|
|
47512
47512
|
* Removes a value from the document.
|
|
47513
47513
|
* @returns `true` if the item was found and removed.
|
|
47514
47514
|
*/
|
|
47515
|
-
deleteIn(
|
|
47516
|
-
if (Collection.isEmptyPath(
|
|
47515
|
+
deleteIn(path35) {
|
|
47516
|
+
if (Collection.isEmptyPath(path35)) {
|
|
47517
47517
|
if (this.contents == null)
|
|
47518
47518
|
return false;
|
|
47519
47519
|
this.contents = null;
|
|
47520
47520
|
return true;
|
|
47521
47521
|
}
|
|
47522
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
47522
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path35) : false;
|
|
47523
47523
|
}
|
|
47524
47524
|
/**
|
|
47525
47525
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -47534,10 +47534,10 @@ var require_Document = __commonJS({
|
|
|
47534
47534
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
47535
47535
|
* `true` (collections are always returned intact).
|
|
47536
47536
|
*/
|
|
47537
|
-
getIn(
|
|
47538
|
-
if (Collection.isEmptyPath(
|
|
47537
|
+
getIn(path35, keepScalar) {
|
|
47538
|
+
if (Collection.isEmptyPath(path35))
|
|
47539
47539
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
47540
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
47540
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path35, keepScalar) : void 0;
|
|
47541
47541
|
}
|
|
47542
47542
|
/**
|
|
47543
47543
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -47548,10 +47548,10 @@ var require_Document = __commonJS({
|
|
|
47548
47548
|
/**
|
|
47549
47549
|
* Checks if the document includes a value at `path`.
|
|
47550
47550
|
*/
|
|
47551
|
-
hasIn(
|
|
47552
|
-
if (Collection.isEmptyPath(
|
|
47551
|
+
hasIn(path35) {
|
|
47552
|
+
if (Collection.isEmptyPath(path35))
|
|
47553
47553
|
return this.contents !== void 0;
|
|
47554
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
47554
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path35) : false;
|
|
47555
47555
|
}
|
|
47556
47556
|
/**
|
|
47557
47557
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -47568,13 +47568,13 @@ var require_Document = __commonJS({
|
|
|
47568
47568
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
47569
47569
|
* boolean to add/remove the item from the set.
|
|
47570
47570
|
*/
|
|
47571
|
-
setIn(
|
|
47572
|
-
if (Collection.isEmptyPath(
|
|
47571
|
+
setIn(path35, value) {
|
|
47572
|
+
if (Collection.isEmptyPath(path35)) {
|
|
47573
47573
|
this.contents = value;
|
|
47574
47574
|
} else if (this.contents == null) {
|
|
47575
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
47575
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path35), value);
|
|
47576
47576
|
} else if (assertCollection(this.contents)) {
|
|
47577
|
-
this.contents.setIn(
|
|
47577
|
+
this.contents.setIn(path35, value);
|
|
47578
47578
|
}
|
|
47579
47579
|
}
|
|
47580
47580
|
/**
|
|
@@ -49531,9 +49531,9 @@ var require_cst_visit = __commonJS({
|
|
|
49531
49531
|
visit.BREAK = BREAK;
|
|
49532
49532
|
visit.SKIP = SKIP;
|
|
49533
49533
|
visit.REMOVE = REMOVE;
|
|
49534
|
-
visit.itemAtPath = (cst,
|
|
49534
|
+
visit.itemAtPath = (cst, path35) => {
|
|
49535
49535
|
let item = cst;
|
|
49536
|
-
for (const [field, index] of
|
|
49536
|
+
for (const [field, index] of path35) {
|
|
49537
49537
|
const tok = item?.[field];
|
|
49538
49538
|
if (tok && "items" in tok) {
|
|
49539
49539
|
item = tok.items[index];
|
|
@@ -49542,23 +49542,23 @@ var require_cst_visit = __commonJS({
|
|
|
49542
49542
|
}
|
|
49543
49543
|
return item;
|
|
49544
49544
|
};
|
|
49545
|
-
visit.parentCollection = (cst,
|
|
49546
|
-
const parent = visit.itemAtPath(cst,
|
|
49547
|
-
const field =
|
|
49545
|
+
visit.parentCollection = (cst, path35) => {
|
|
49546
|
+
const parent = visit.itemAtPath(cst, path35.slice(0, -1));
|
|
49547
|
+
const field = path35[path35.length - 1][0];
|
|
49548
49548
|
const coll = parent?.[field];
|
|
49549
49549
|
if (coll && "items" in coll)
|
|
49550
49550
|
return coll;
|
|
49551
49551
|
throw new Error("Parent collection not found");
|
|
49552
49552
|
};
|
|
49553
|
-
function _visit(
|
|
49554
|
-
let ctrl = visitor(item,
|
|
49553
|
+
function _visit(path35, item, visitor) {
|
|
49554
|
+
let ctrl = visitor(item, path35);
|
|
49555
49555
|
if (typeof ctrl === "symbol")
|
|
49556
49556
|
return ctrl;
|
|
49557
49557
|
for (const field of ["key", "value"]) {
|
|
49558
49558
|
const token = item[field];
|
|
49559
49559
|
if (token && "items" in token) {
|
|
49560
49560
|
for (let i = 0; i < token.items.length; ++i) {
|
|
49561
|
-
const ci = _visit(Object.freeze(
|
|
49561
|
+
const ci = _visit(Object.freeze(path35.concat([[field, i]])), token.items[i], visitor);
|
|
49562
49562
|
if (typeof ci === "number")
|
|
49563
49563
|
i = ci - 1;
|
|
49564
49564
|
else if (ci === BREAK)
|
|
@@ -49569,10 +49569,10 @@ var require_cst_visit = __commonJS({
|
|
|
49569
49569
|
}
|
|
49570
49570
|
}
|
|
49571
49571
|
if (typeof ctrl === "function" && field === "key")
|
|
49572
|
-
ctrl = ctrl(item,
|
|
49572
|
+
ctrl = ctrl(item, path35);
|
|
49573
49573
|
}
|
|
49574
49574
|
}
|
|
49575
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
49575
|
+
return typeof ctrl === "function" ? ctrl(item, path35) : ctrl;
|
|
49576
49576
|
}
|
|
49577
49577
|
exports.visit = visit;
|
|
49578
49578
|
}
|
|
@@ -50857,14 +50857,14 @@ var require_parser2 = __commonJS({
|
|
|
50857
50857
|
case "scalar":
|
|
50858
50858
|
case "single-quoted-scalar":
|
|
50859
50859
|
case "double-quoted-scalar": {
|
|
50860
|
-
const
|
|
50860
|
+
const fs31 = this.flowScalar(this.type);
|
|
50861
50861
|
if (atNextItem || it.value) {
|
|
50862
|
-
map.items.push({ start, key:
|
|
50862
|
+
map.items.push({ start, key: fs31, sep: [] });
|
|
50863
50863
|
this.onKeyLine = true;
|
|
50864
50864
|
} else if (it.sep) {
|
|
50865
|
-
this.stack.push(
|
|
50865
|
+
this.stack.push(fs31);
|
|
50866
50866
|
} else {
|
|
50867
|
-
Object.assign(it, { key:
|
|
50867
|
+
Object.assign(it, { key: fs31, sep: [] });
|
|
50868
50868
|
this.onKeyLine = true;
|
|
50869
50869
|
}
|
|
50870
50870
|
return;
|
|
@@ -50992,13 +50992,13 @@ var require_parser2 = __commonJS({
|
|
|
50992
50992
|
case "scalar":
|
|
50993
50993
|
case "single-quoted-scalar":
|
|
50994
50994
|
case "double-quoted-scalar": {
|
|
50995
|
-
const
|
|
50995
|
+
const fs31 = this.flowScalar(this.type);
|
|
50996
50996
|
if (!it || it.value)
|
|
50997
|
-
fc.items.push({ start: [], key:
|
|
50997
|
+
fc.items.push({ start: [], key: fs31, sep: [] });
|
|
50998
50998
|
else if (it.sep)
|
|
50999
|
-
this.stack.push(
|
|
50999
|
+
this.stack.push(fs31);
|
|
51000
51000
|
else
|
|
51001
|
-
Object.assign(it, { key:
|
|
51001
|
+
Object.assign(it, { key: fs31, sep: [] });
|
|
51002
51002
|
return;
|
|
51003
51003
|
}
|
|
51004
51004
|
case "flow-map-end":
|
|
@@ -51307,8 +51307,8 @@ var require_dist2 = __commonJS({
|
|
|
51307
51307
|
});
|
|
51308
51308
|
|
|
51309
51309
|
// src/cli.ts
|
|
51310
|
-
import * as
|
|
51311
|
-
import * as
|
|
51310
|
+
import * as fs30 from "fs";
|
|
51311
|
+
import * as path34 from "path";
|
|
51312
51312
|
|
|
51313
51313
|
// src/cli-args.ts
|
|
51314
51314
|
var FLAGS_WITH_VALUES = /* @__PURE__ */ new Set(["--session-id", "--extension-path", "--developer-instructions", "--developer-instructions-file"]);
|
|
@@ -51895,6 +51895,7 @@ var SettingsManager = class {
|
|
|
51895
51895
|
this.settingsLastWritten = cloneJsonDocument(this.settings);
|
|
51896
51896
|
this.legacyConfig = this.loadLegacyConfigFile();
|
|
51897
51897
|
this.legacyConfigLastWritten = cloneJsonDocument(this.legacyConfig);
|
|
51898
|
+
this.managerScopedEnv = this.readManagerScopedEnv();
|
|
51898
51899
|
}
|
|
51899
51900
|
readJson(filePath) {
|
|
51900
51901
|
if (!fs2.existsSync(filePath)) return null;
|
|
@@ -51956,10 +51957,27 @@ var SettingsManager = class {
|
|
|
51956
51957
|
getLegacyApiKey() {
|
|
51957
51958
|
return this.legacyConfig.apiKey;
|
|
51958
51959
|
}
|
|
51960
|
+
/** 4.3.7 manager-scoped model env, scoped to manager-bootstrapped
|
|
51961
|
+
* processes: the env pair is injected by managerSpawnEnv() and — because
|
|
51962
|
+
* spawn env is inherited by EVERY descendant (a pie the user starts
|
|
51963
|
+
* inside a manager-owned shell would otherwise silently switch models,
|
|
51964
|
+
* P2 review) — it only applies while the process was itself launched
|
|
51965
|
+
* with the manager bootstrap marker. The marker is set by the same
|
|
51966
|
+
* spawn env, and the bash tool strips both vars from child shells, so
|
|
51967
|
+
* the pair never leaks past the manager's own process tree boundary. */
|
|
51968
|
+
managerScopedEnv;
|
|
51969
|
+
readManagerScopedEnv() {
|
|
51970
|
+
if (process.env.PIE_MANAGER_BOOTSTRAP !== "1") return {};
|
|
51971
|
+
const provider = process.env.PIE_DEFAULT_PROVIDER?.trim();
|
|
51972
|
+
const model = process.env.PIE_DEFAULT_MODEL?.trim();
|
|
51973
|
+
return provider && model ? { provider, model } : {};
|
|
51974
|
+
}
|
|
51959
51975
|
getDefaultProvider() {
|
|
51976
|
+
if (this.managerScopedEnv.provider) return this.managerScopedEnv.provider;
|
|
51960
51977
|
return this.settings.defaultProvider || this.legacyConfig.provider;
|
|
51961
51978
|
}
|
|
51962
51979
|
getDefaultModel() {
|
|
51980
|
+
if (this.managerScopedEnv.model) return this.managerScopedEnv.model;
|
|
51963
51981
|
return this.settings.defaultModel || this.legacyConfig.modelId;
|
|
51964
51982
|
}
|
|
51965
51983
|
getDefaultThinkingLevel() {
|
|
@@ -54936,19 +54954,19 @@ var CommandTree = class {
|
|
|
54936
54954
|
* register(["session", "new"], { description, handler })
|
|
54937
54955
|
* register(["tools", "subagent", "spawn", "local"], { description, handler })
|
|
54938
54956
|
*/
|
|
54939
|
-
register(
|
|
54940
|
-
if (
|
|
54957
|
+
register(path35, info) {
|
|
54958
|
+
if (path35.length === 0) {
|
|
54941
54959
|
throw new Error("Command path cannot be empty");
|
|
54942
54960
|
}
|
|
54943
54961
|
let current = this.root;
|
|
54944
54962
|
const fullPath = [];
|
|
54945
|
-
for (let i = 0; i <
|
|
54946
|
-
const segment =
|
|
54963
|
+
for (let i = 0; i < path35.length; i++) {
|
|
54964
|
+
const segment = path35[i];
|
|
54947
54965
|
fullPath.push(segment);
|
|
54948
54966
|
if (!current.children) {
|
|
54949
54967
|
current.children = [];
|
|
54950
54968
|
}
|
|
54951
|
-
const isLast = i ===
|
|
54969
|
+
const isLast = i === path35.length - 1;
|
|
54952
54970
|
let node = current.children.find((n) => n.name === segment);
|
|
54953
54971
|
if (!node) {
|
|
54954
54972
|
node = {
|
|
@@ -54978,31 +54996,31 @@ var CommandTree = class {
|
|
|
54978
54996
|
/**
|
|
54979
54997
|
* Find a node by path
|
|
54980
54998
|
*/
|
|
54981
|
-
find(
|
|
54982
|
-
if (
|
|
54999
|
+
find(path35) {
|
|
55000
|
+
if (path35.length === 0) {
|
|
54983
55001
|
return this.root;
|
|
54984
55002
|
}
|
|
54985
|
-
const key =
|
|
55003
|
+
const key = path35.join("/");
|
|
54986
55004
|
return this.pathCache.get(key) || null;
|
|
54987
55005
|
}
|
|
54988
55006
|
/**
|
|
54989
55007
|
* Get children of a path
|
|
54990
55008
|
*/
|
|
54991
|
-
getChildren(
|
|
54992
|
-
const node = this.find(
|
|
55009
|
+
getChildren(path35) {
|
|
55010
|
+
const node = this.find(path35);
|
|
54993
55011
|
return (node?.children || []).filter((child) => !child.hidden);
|
|
54994
55012
|
}
|
|
54995
55013
|
/**
|
|
54996
55014
|
* Check if a path exists (as category or command)
|
|
54997
55015
|
*/
|
|
54998
|
-
exists(
|
|
54999
|
-
return this.find(
|
|
55016
|
+
exists(path35) {
|
|
55017
|
+
return this.find(path35) !== null;
|
|
55000
55018
|
}
|
|
55001
55019
|
/**
|
|
55002
55020
|
* Check if path is a category (has children)
|
|
55003
55021
|
*/
|
|
55004
|
-
isCategory(
|
|
55005
|
-
const node = this.find(
|
|
55022
|
+
isCategory(path35) {
|
|
55023
|
+
const node = this.find(path35);
|
|
55006
55024
|
return node?.isCategory || false;
|
|
55007
55025
|
}
|
|
55008
55026
|
/**
|
|
@@ -55081,8 +55099,8 @@ var CommandTree = class {
|
|
|
55081
55099
|
* Supports dot notation: "tools.subagent.spawn.local"
|
|
55082
55100
|
*/
|
|
55083
55101
|
registerFromPath(pathStr, info) {
|
|
55084
|
-
const
|
|
55085
|
-
this.register(
|
|
55102
|
+
const path35 = pathStr.split(/[./]/).filter(Boolean);
|
|
55103
|
+
this.register(path35, info);
|
|
55086
55104
|
}
|
|
55087
55105
|
};
|
|
55088
55106
|
var commandTree = new CommandTree();
|
|
@@ -55163,13 +55181,13 @@ function createExtensionContext(extension, cwd, uiContext, abortFn, isIdleFn, ca
|
|
|
55163
55181
|
actions?.sendUserMessage(content);
|
|
55164
55182
|
},
|
|
55165
55183
|
...actions?.attachLocalFile ? {
|
|
55166
|
-
attachLocalFile: (
|
|
55184
|
+
attachLocalFile: (path35, displayName) => actions.attachLocalFile(path35, displayName)
|
|
55167
55185
|
} : {},
|
|
55168
55186
|
...actions?.beginUserInput ? {
|
|
55169
55187
|
beginUserInput: (isCurrent) => actions.beginUserInput(isCurrent)
|
|
55170
55188
|
} : {},
|
|
55171
55189
|
...actions?.attachLocalFileAndSubmit ? {
|
|
55172
|
-
attachLocalFileAndSubmit: (
|
|
55190
|
+
attachLocalFileAndSubmit: (path35, displayName, submitText) => actions.attachLocalFileAndSubmit(path35, displayName, submitText)
|
|
55173
55191
|
} : {},
|
|
55174
55192
|
setPlanMode(enabled, options) {
|
|
55175
55193
|
actions?.setPlanMode(enabled, options);
|
|
@@ -63157,7 +63175,12 @@ var Osc5522Client = class {
|
|
|
63157
63175
|
};
|
|
63158
63176
|
|
|
63159
63177
|
// ../../packages/tui/src/terminal.ts
|
|
63160
|
-
var
|
|
63178
|
+
var TERMINATION_SIGNAL_CODES = {
|
|
63179
|
+
SIGHUP: 1,
|
|
63180
|
+
SIGINT: 2,
|
|
63181
|
+
SIGTERM: 15
|
|
63182
|
+
};
|
|
63183
|
+
var ProcessTerminal = class _ProcessTerminal {
|
|
63161
63184
|
wasRaw = false;
|
|
63162
63185
|
/** Client for the Kitty OSC 5522 clipboard protocol (read side). */
|
|
63163
63186
|
osc5522Client = new Osc5522Client();
|
|
@@ -63168,6 +63191,84 @@ var ProcessTerminal = class {
|
|
|
63168
63191
|
inputHandler;
|
|
63169
63192
|
resizeHandler;
|
|
63170
63193
|
_kittyProtocolActive = false;
|
|
63194
|
+
/** Restore sequences sent on every teardown path. Idempotent: re-sending
|
|
63195
|
+
* on an already-clean terminal is a no-op, so the exit hook and stop()
|
|
63196
|
+
* can both run. 4.3.7: any abnormal exit (timeout kill, SIGKILL-adjacent
|
|
63197
|
+
* paths, crash) used to leak kitty-keyboard push / bracketed-paste /
|
|
63198
|
+
* DECAWM state into the user's shell (arrows echoed as CSI-u text). */
|
|
63199
|
+
static RESTORE_SEQUENCE = "\x1B[<9999u\x1B[?2004l\x1B[?2026l\x1B[?7h";
|
|
63200
|
+
exitHookInstalled = false;
|
|
63201
|
+
/** Whether stop() has completed. The exit hook uses this to only touch
|
|
63202
|
+
* raw mode on teardown paths that bypassed stop() (crash/kill). */
|
|
63203
|
+
stopped = false;
|
|
63204
|
+
/** Emit the idempotent mode-stack reset (kitty pop-all + bracketed paste
|
|
63205
|
+
* off + sync output off + autowrap on). Safe any number of times: these
|
|
63206
|
+
* are pure state sets/pops, so stop() and the exit hook may both run.
|
|
63207
|
+
* Raw mode is deliberately NOT handled here — stop() restores it AFTER
|
|
63208
|
+
* stdin.pause() (ordering matters: pause-then-unraw closes the Ctrl+D
|
|
63209
|
+
* race with the parent shell), and the exit hook only forces cooked
|
|
63210
|
+
* mode when stop() never ran. */
|
|
63211
|
+
restoreTerminalState() {
|
|
63212
|
+
process.stdout.write(_ProcessTerminal.RESTORE_SEQUENCE);
|
|
63213
|
+
if (this._kittyProtocolActive) {
|
|
63214
|
+
this._kittyProtocolActive = false;
|
|
63215
|
+
setKittyProtocolActive(false);
|
|
63216
|
+
}
|
|
63217
|
+
}
|
|
63218
|
+
/** Crash-path raw-mode fallback: if the process is exiting while the TUI
|
|
63219
|
+
* still owns a raw tty (stop() bypassed), leaving raw mode on hands the
|
|
63220
|
+
* user's shell a broken input state. Only stop() knows the correct
|
|
63221
|
+
* previous value (wasRaw) — on crash paths cooked mode is the safe bet.
|
|
63222
|
+
* P2(review): pause BEFORE unraw, mirroring stop()'s documented Ctrl+D
|
|
63223
|
+
* race ordering — a crash while input is flowing must not hand the
|
|
63224
|
+
* parent shell buffered input in cooked mode. */
|
|
63225
|
+
forceCookedModeIfActive() {
|
|
63226
|
+
if (this.stopped) return;
|
|
63227
|
+
if (process.stdin.setRawMode && process.stdin.isRaw) {
|
|
63228
|
+
try {
|
|
63229
|
+
process.stdin.pause();
|
|
63230
|
+
} catch {
|
|
63231
|
+
}
|
|
63232
|
+
try {
|
|
63233
|
+
process.stdin.setRawMode(false);
|
|
63234
|
+
} catch {
|
|
63235
|
+
}
|
|
63236
|
+
}
|
|
63237
|
+
}
|
|
63238
|
+
/** P1(review 4.3.7): process.on("exit") does NOT run when the process is
|
|
63239
|
+
* terminated by a signal under default disposition — `timeout 25 pie`
|
|
63240
|
+
* sends SIGTERM, external kills send SIGTERM/SIGHUP, and the exit hook
|
|
63241
|
+
* alone never fires on those paths (verified on Node 24). Register
|
|
63242
|
+
* explicit teardown for the signals that terminate the interactive TUI:
|
|
63243
|
+
* restore the terminal, then exit with the conventional 128+sig status.
|
|
63244
|
+
* Removed in stop() so a stopped-TUI process falls back to default
|
|
63245
|
+
* disposition. SIGINT is included because raw mode clears ISIG — a
|
|
63246
|
+
* keyboard Ctrl+C is delivered as INPUT (handled by the app's clean
|
|
63247
|
+
* exit), so this handler only sees external `kill -INT`. */
|
|
63248
|
+
static TERMINATION_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
63249
|
+
signalListener;
|
|
63250
|
+
installTerminationSignalHandlers() {
|
|
63251
|
+
if (this.signalListener) return;
|
|
63252
|
+
this.signalListener = (signal) => {
|
|
63253
|
+
try {
|
|
63254
|
+
this.restoreTerminalState();
|
|
63255
|
+
} finally {
|
|
63256
|
+
this.forceCookedModeIfActive();
|
|
63257
|
+
}
|
|
63258
|
+
const signo = TERMINATION_SIGNAL_CODES[signal];
|
|
63259
|
+
process.exit(signo !== void 0 ? 128 + signo : 128);
|
|
63260
|
+
};
|
|
63261
|
+
for (const signal of _ProcessTerminal.TERMINATION_SIGNALS) {
|
|
63262
|
+
process.on(signal, this.signalListener);
|
|
63263
|
+
}
|
|
63264
|
+
}
|
|
63265
|
+
removeTerminationSignalHandlers() {
|
|
63266
|
+
if (!this.signalListener) return;
|
|
63267
|
+
for (const signal of _ProcessTerminal.TERMINATION_SIGNALS) {
|
|
63268
|
+
process.removeListener(signal, this.signalListener);
|
|
63269
|
+
}
|
|
63270
|
+
this.signalListener = void 0;
|
|
63271
|
+
}
|
|
63171
63272
|
stdinBuffer;
|
|
63172
63273
|
stdinDataHandler;
|
|
63173
63274
|
writeLogPath = process.env.PIE_TUI_WRITE_LOG || "";
|
|
@@ -63181,6 +63282,19 @@ var ProcessTerminal = class {
|
|
|
63181
63282
|
start(onInput, onResize) {
|
|
63182
63283
|
this.inputHandler = onInput;
|
|
63183
63284
|
this.resizeHandler = onResize;
|
|
63285
|
+
process.stdout.write(_ProcessTerminal.RESTORE_SEQUENCE);
|
|
63286
|
+
this.stopped = false;
|
|
63287
|
+
this.installTerminationSignalHandlers();
|
|
63288
|
+
if (!this.exitHookInstalled) {
|
|
63289
|
+
this.exitHookInstalled = true;
|
|
63290
|
+
process.on("exit", () => {
|
|
63291
|
+
try {
|
|
63292
|
+
this.restoreTerminalState();
|
|
63293
|
+
} finally {
|
|
63294
|
+
this.forceCookedModeIfActive();
|
|
63295
|
+
}
|
|
63296
|
+
});
|
|
63297
|
+
}
|
|
63184
63298
|
this.wasRaw = process.stdin.isRaw || false;
|
|
63185
63299
|
if (process.stdin.setRawMode) {
|
|
63186
63300
|
process.stdin.setRawMode(true);
|
|
@@ -63302,14 +63416,10 @@ var ProcessTerminal = class {
|
|
|
63302
63416
|
}
|
|
63303
63417
|
}
|
|
63304
63418
|
stop() {
|
|
63305
|
-
|
|
63419
|
+
this.restoreTerminalState();
|
|
63420
|
+
this.stopped = true;
|
|
63421
|
+
this.removeTerminationSignalHandlers();
|
|
63306
63422
|
this.lastTitle = null;
|
|
63307
|
-
process.stdout.write("\x1B[?7h");
|
|
63308
|
-
if (this._kittyProtocolActive && !process.env.PIE_DISABLE_KITTY_PROTOCOL) {
|
|
63309
|
-
process.stdout.write("\x1B[<u");
|
|
63310
|
-
this._kittyProtocolActive = false;
|
|
63311
|
-
setKittyProtocolActive(false);
|
|
63312
|
-
}
|
|
63313
63423
|
if (this.stdinBuffer) {
|
|
63314
63424
|
this.stdinBuffer.destroy();
|
|
63315
63425
|
this.stdinBuffer = void 0;
|
|
@@ -63609,13 +63719,13 @@ var ExtensionRunner = class {
|
|
|
63609
63719
|
getActiveTools: () => this.actions.getActiveTools(),
|
|
63610
63720
|
sendUserMessage: (content) => this.actions.sendUserMessage(content),
|
|
63611
63721
|
...this.actions.attachLocalFile ? {
|
|
63612
|
-
attachLocalFile: (
|
|
63722
|
+
attachLocalFile: (path35, displayName) => this.actions.attachLocalFile(path35, displayName)
|
|
63613
63723
|
} : {},
|
|
63614
63724
|
...this.actions.beginUserInput ? {
|
|
63615
63725
|
beginUserInput: (isCurrent) => this.actions.beginUserInput(isCurrent)
|
|
63616
63726
|
} : {},
|
|
63617
63727
|
...this.actions.attachLocalFileAndSubmit ? {
|
|
63618
|
-
attachLocalFileAndSubmit: (
|
|
63728
|
+
attachLocalFileAndSubmit: (path35, displayName, submitText) => this.actions.attachLocalFileAndSubmit(path35, displayName, submitText)
|
|
63619
63729
|
} : {},
|
|
63620
63730
|
setPlanMode: (enabled, options) => this.actions.setPlanMode(enabled, options),
|
|
63621
63731
|
setExecutionReminder: (text) => this.actions.setExecutionReminder(text),
|
|
@@ -64316,10 +64426,10 @@ var KeybindingsManager = class _KeybindingsManager {
|
|
|
64316
64426
|
static inMemory(config = {}) {
|
|
64317
64427
|
return new _KeybindingsManager(config);
|
|
64318
64428
|
}
|
|
64319
|
-
static loadFromFile(
|
|
64320
|
-
if (!existsSync6(
|
|
64429
|
+
static loadFromFile(path35) {
|
|
64430
|
+
if (!existsSync6(path35)) return {};
|
|
64321
64431
|
try {
|
|
64322
|
-
return JSON.parse(readFileSync7(
|
|
64432
|
+
return JSON.parse(readFileSync7(path35, "utf-8"));
|
|
64323
64433
|
} catch {
|
|
64324
64434
|
return {};
|
|
64325
64435
|
}
|
|
@@ -70211,10 +70321,10 @@ function parseProjectContextSection(section) {
|
|
|
70211
70321
|
const parts = section.split(/^### (.+)$/m);
|
|
70212
70322
|
const files = [];
|
|
70213
70323
|
for (let i = 1; i + 1 < parts.length + 1; i += 2) {
|
|
70214
|
-
const
|
|
70324
|
+
const path35 = (parts[i] ?? "").trim();
|
|
70215
70325
|
const content = (parts[i + 1] ?? "").trim();
|
|
70216
|
-
if (!
|
|
70217
|
-
files.push({ path:
|
|
70326
|
+
if (!path35 || !content) continue;
|
|
70327
|
+
files.push({ path: path35, content });
|
|
70218
70328
|
}
|
|
70219
70329
|
return files;
|
|
70220
70330
|
}
|
|
@@ -71659,13 +71769,13 @@ function formatSize2(bytes) {
|
|
|
71659
71769
|
}
|
|
71660
71770
|
var DEFAULT_MAX_BYTES = 102400;
|
|
71661
71771
|
var DEFAULT_MAX_LINES = 100;
|
|
71662
|
-
function shortenPath(
|
|
71663
|
-
if (typeof
|
|
71772
|
+
function shortenPath(path35) {
|
|
71773
|
+
if (typeof path35 !== "string") return "";
|
|
71664
71774
|
const home = os5.homedir();
|
|
71665
|
-
if (
|
|
71666
|
-
return `~${
|
|
71775
|
+
if (path35.startsWith(home)) {
|
|
71776
|
+
return `~${path35.slice(home.length)}`;
|
|
71667
71777
|
}
|
|
71668
|
-
return
|
|
71778
|
+
return path35;
|
|
71669
71779
|
}
|
|
71670
71780
|
function replaceTabs(text) {
|
|
71671
71781
|
return text.replace(/\t/g, " ");
|
|
@@ -71776,14 +71886,14 @@ ${renderManageTodoListResult(this.result, { expanded: this.expanded }, theme)}`;
|
|
|
71776
71886
|
}
|
|
71777
71887
|
} else if (this.toolName === "read_file") {
|
|
71778
71888
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
71779
|
-
const
|
|
71889
|
+
const path35 = rawPath !== null ? shortenPath(rawPath) : null;
|
|
71780
71890
|
const offset = typeof this.args?.offset === "number" ? this.args.offset : void 0;
|
|
71781
71891
|
const limit = typeof this.args?.limit === "number" ? this.args.limit : void 0;
|
|
71782
71892
|
let pathDisplay;
|
|
71783
|
-
if (
|
|
71893
|
+
if (path35 === null) {
|
|
71784
71894
|
pathDisplay = invalidArg;
|
|
71785
|
-
} else if (
|
|
71786
|
-
pathDisplay = theme.fg("accent",
|
|
71895
|
+
} else if (path35) {
|
|
71896
|
+
pathDisplay = theme.fg("accent", path35);
|
|
71787
71897
|
} else {
|
|
71788
71898
|
const partialPath = partialStr(this.args?.file_path ?? this.args?.path);
|
|
71789
71899
|
pathDisplay = theme.fg("toolOutput", partialPath);
|
|
@@ -71830,12 +71940,12 @@ ${renderManageTodoListResult(this.result, { expanded: this.expanded }, theme)}`;
|
|
|
71830
71940
|
} else if (this.toolName === "write_file") {
|
|
71831
71941
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
71832
71942
|
const fileContent = str(this.args?.content);
|
|
71833
|
-
const
|
|
71943
|
+
const path35 = rawPath !== null ? shortenPath(rawPath) : null;
|
|
71834
71944
|
let pathDisplay;
|
|
71835
|
-
if (
|
|
71945
|
+
if (path35 === null) {
|
|
71836
71946
|
pathDisplay = invalidArg;
|
|
71837
|
-
} else if (
|
|
71838
|
-
pathDisplay = theme.fg("accent",
|
|
71947
|
+
} else if (path35) {
|
|
71948
|
+
pathDisplay = theme.fg("accent", path35);
|
|
71839
71949
|
} else {
|
|
71840
71950
|
const partialPath = partialStr(this.args?.file_path ?? this.args?.path);
|
|
71841
71951
|
pathDisplay = theme.fg("toolOutput", partialPath);
|
|
@@ -71872,12 +71982,12 @@ ${theme.fg("error", errorText)}`;
|
|
|
71872
71982
|
}
|
|
71873
71983
|
} else if (this.toolName === "edit_file") {
|
|
71874
71984
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
71875
|
-
const
|
|
71985
|
+
const path35 = rawPath !== null ? shortenPath(rawPath) : null;
|
|
71876
71986
|
let pathDisplay;
|
|
71877
|
-
if (
|
|
71987
|
+
if (path35 === null) {
|
|
71878
71988
|
pathDisplay = invalidArg;
|
|
71879
|
-
} else if (
|
|
71880
|
-
pathDisplay = theme.fg("accent",
|
|
71989
|
+
} else if (path35) {
|
|
71990
|
+
pathDisplay = theme.fg("accent", path35);
|
|
71881
71991
|
} else {
|
|
71882
71992
|
const partialPath = partialStr(this.args?.file_path ?? this.args?.path);
|
|
71883
71993
|
pathDisplay = theme.fg("toolOutput", partialPath);
|
|
@@ -71902,7 +72012,7 @@ ${theme.fg("error", errorText)}`;
|
|
|
71902
72012
|
const diff = this.result.details.diff;
|
|
71903
72013
|
const firstChangedLine = this.result.details.firstChangedLine;
|
|
71904
72014
|
if (firstChangedLine) {
|
|
71905
|
-
text = `${theme.fg("toolTitle", theme.bold("edit_file"))} ${theme.fg("accent",
|
|
72015
|
+
text = `${theme.fg("toolTitle", theme.bold("edit_file"))} ${theme.fg("accent", path35 || rawPath)}${theme.fg("warning", `:${firstChangedLine}`)}`;
|
|
71906
72016
|
}
|
|
71907
72017
|
const lines = diff.split("\n");
|
|
71908
72018
|
const maxLines = this.expanded ? lines.length : 15;
|
|
@@ -71922,7 +72032,7 @@ ${theme.fg("error", errorText)}`;
|
|
|
71922
72032
|
const diff = generateEditDiff(oldText, newText, rawPath);
|
|
71923
72033
|
const firstChangedLine = findFirstChangedLine(oldText, newText);
|
|
71924
72034
|
if (firstChangedLine) {
|
|
71925
|
-
text = `${theme.fg("toolTitle", theme.bold("edit_file"))} ${theme.fg("accent",
|
|
72035
|
+
text = `${theme.fg("toolTitle", theme.bold("edit_file"))} ${theme.fg("accent", path35 || rawPath)}${theme.fg("warning", `:${firstChangedLine}`)}`;
|
|
71926
72036
|
}
|
|
71927
72037
|
const lines = diff.split("\n");
|
|
71928
72038
|
const maxLines = this.expanded ? lines.length : 15;
|
|
@@ -71941,9 +72051,9 @@ ${theme.fg("error", errorText)}`;
|
|
|
71941
72051
|
}
|
|
71942
72052
|
} else if (this.toolName === "list_dir") {
|
|
71943
72053
|
const rawPath = str(this.args?.path);
|
|
71944
|
-
const
|
|
72054
|
+
const path35 = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
71945
72055
|
const limit = this.args?.limit;
|
|
71946
|
-
text = `${theme.fg("toolTitle", theme.bold("list_dir"))} ${
|
|
72056
|
+
text = `${theme.fg("toolTitle", theme.bold("list_dir"))} ${path35 === null ? invalidArg : theme.fg("accent", path35)}`;
|
|
71947
72057
|
if (limit !== void 0) {
|
|
71948
72058
|
text += theme.fg("toolOutput", ` (limit ${limit})`);
|
|
71949
72059
|
}
|
|
@@ -71979,9 +72089,9 @@ ${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
|
|
|
71979
72089
|
} else if (this.toolName === "find_files") {
|
|
71980
72090
|
const pattern = str(this.args?.pattern);
|
|
71981
72091
|
const rawPath = str(this.args?.path);
|
|
71982
|
-
const
|
|
72092
|
+
const path35 = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
71983
72093
|
const limit = this.args?.limit;
|
|
71984
|
-
text = theme.fg("toolTitle", theme.bold("find_files")) + " " + (pattern === null ? invalidArg : theme.fg("accent", pattern || "")) + theme.fg("toolOutput", ` in ${
|
|
72094
|
+
text = theme.fg("toolTitle", theme.bold("find_files")) + " " + (pattern === null ? invalidArg : theme.fg("accent", pattern || "")) + theme.fg("toolOutput", ` in ${path35 === null ? invalidArg : path35}`);
|
|
71985
72095
|
if (limit !== void 0) {
|
|
71986
72096
|
text += theme.fg("toolOutput", ` (limit ${limit})`);
|
|
71987
72097
|
}
|
|
@@ -72017,10 +72127,10 @@ ${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
|
|
|
72017
72127
|
} else if (this.toolName === "grep_text") {
|
|
72018
72128
|
const pattern = str(this.args?.pattern);
|
|
72019
72129
|
const rawPath = str(this.args?.path);
|
|
72020
|
-
const
|
|
72130
|
+
const path35 = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
72021
72131
|
const glob = str(this.args?.glob);
|
|
72022
72132
|
const limit = this.args?.limit;
|
|
72023
|
-
text = theme.fg("toolTitle", theme.bold("grep_text")) + " " + (pattern === null ? invalidArg : theme.fg("accent", `/${pattern || ""}/`)) + theme.fg("toolOutput", ` in ${
|
|
72133
|
+
text = theme.fg("toolTitle", theme.bold("grep_text")) + " " + (pattern === null ? invalidArg : theme.fg("accent", `/${pattern || ""}/`)) + theme.fg("toolOutput", ` in ${path35 === null ? invalidArg : path35}`);
|
|
72024
72134
|
if (glob) {
|
|
72025
72135
|
text += theme.fg("toolOutput", ` (${glob})`);
|
|
72026
72136
|
}
|
|
@@ -72722,8 +72832,8 @@ async function forkAtEntry(host, entryId) {
|
|
|
72722
72832
|
host.showError("Failed to branch at entry");
|
|
72723
72833
|
return;
|
|
72724
72834
|
}
|
|
72725
|
-
const
|
|
72726
|
-
const pathNames =
|
|
72835
|
+
const path35 = host.sessionManager.getPathSummaries(entryId);
|
|
72836
|
+
const pathNames = path35.map((summary) => summary.role || summary.type).join(" \u2192 ");
|
|
72727
72837
|
const messages = host.sessionManager.getMessages();
|
|
72728
72838
|
host.syncAgentFromActiveSession(messages);
|
|
72729
72839
|
await host.syncSessionScopedState(messages);
|
|
@@ -72736,7 +72846,7 @@ async function forkAtEntry(host, entryId) {
|
|
|
72736
72846
|
host.updatePendingMessagesDisplay();
|
|
72737
72847
|
host.renderMessageHistory(messages);
|
|
72738
72848
|
await host.sessionManager.save();
|
|
72739
|
-
host.showStatus(`Branched at: ${pathNames} (${
|
|
72849
|
+
host.showStatus(`Branched at: ${pathNames} (${path35.length} messages). Continue to add to this branch.`);
|
|
72740
72850
|
} catch (error) {
|
|
72741
72851
|
host.showError(
|
|
72742
72852
|
`Failed to branch: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -72764,10 +72874,10 @@ async function navigateToEntry(host, entryId) {
|
|
|
72764
72874
|
host.sessionManager.save().catch((err) => {
|
|
72765
72875
|
console.error("[Session] Save after navigation failed:", err);
|
|
72766
72876
|
});
|
|
72767
|
-
const
|
|
72877
|
+
const path35 = host.sessionManager.getPathSummaries(entryId);
|
|
72768
72878
|
const summary = host.sessionManager.getEntrySummary(entryId);
|
|
72769
72879
|
const role = summary?.role || summary?.type || "entry";
|
|
72770
|
-
host.showStatus(`Switched to branch: ${role} (${
|
|
72880
|
+
host.showStatus(`Switched to branch: ${role} (${path35.length} entries in path)`);
|
|
72771
72881
|
} catch (error) {
|
|
72772
72882
|
host.showError(
|
|
72773
72883
|
`Failed to navigate: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -78363,8 +78473,8 @@ var MentionHandler = class {
|
|
|
78363
78473
|
* picker-selected file, so submit-time queueing and attachment resolution
|
|
78364
78474
|
* behave identically.
|
|
78365
78475
|
*/
|
|
78366
|
-
async attachLocalFile(
|
|
78367
|
-
return this.attachFileFromPath(
|
|
78476
|
+
async attachLocalFile(path35, displayName, pendingMention, isCurrent) {
|
|
78477
|
+
return this.attachFileFromPath(path35, { sourceName: displayName, queryToken: pendingMention, isCurrent });
|
|
78368
78478
|
}
|
|
78369
78479
|
/** Prepare a message-owned mention without reading or mutating the editor.
|
|
78370
78480
|
* Errors propagate to the caller; no caption-only submission on failure. */
|
|
@@ -78400,12 +78510,12 @@ var MentionHandler = class {
|
|
|
78400
78510
|
* mention, stage or upload the file, then replace the pending mention with
|
|
78401
78511
|
* the final one (or remove it on failure).
|
|
78402
78512
|
*/
|
|
78403
|
-
async attachFileFromPath(
|
|
78404
|
-
const sourceName = options.sourceName ??
|
|
78513
|
+
async attachFileFromPath(path35, options) {
|
|
78514
|
+
const sourceName = options.sourceName ?? path35.split(/[\\/]/).pop() ?? path35;
|
|
78405
78515
|
this.pendingUploadCount += 1;
|
|
78406
78516
|
const pendingMention = options.queryToken?.includes("pending:clipboard-") ? options.queryToken : this.formatPendingMention(sourceName);
|
|
78407
78517
|
this.onInsertMention(pendingMention, options.queryToken);
|
|
78408
|
-
const pendingStatusKey = `${
|
|
78518
|
+
const pendingStatusKey = `${path35}:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`;
|
|
78409
78519
|
try {
|
|
78410
78520
|
if (options.cacheStatus === "uploaded") {
|
|
78411
78521
|
this.pushPendingStatus(
|
|
@@ -78420,7 +78530,7 @@ var MentionHandler = class {
|
|
|
78420
78530
|
} else {
|
|
78421
78531
|
this.pushPendingStatus(pendingStatusKey, `Preparing ${sourceName}...`);
|
|
78422
78532
|
}
|
|
78423
|
-
const mimeType = FileCache.getMimeType(
|
|
78533
|
+
const mimeType = FileCache.getMimeType(path35);
|
|
78424
78534
|
const isMedia = mimeType.startsWith("image/") || mimeType.startsWith("video/");
|
|
78425
78535
|
const shouldStageLocally = !isMedia || !this.fileManager.hasAdapter();
|
|
78426
78536
|
if (isMedia && shouldStageLocally) {
|
|
@@ -78433,7 +78543,7 @@ var MentionHandler = class {
|
|
|
78433
78543
|
this.formatUploadProgress(sourceName, progress, stage)
|
|
78434
78544
|
);
|
|
78435
78545
|
};
|
|
78436
|
-
const result = await this.prepareFile(
|
|
78546
|
+
const result = await this.prepareFile(path35, sourceName, onProgress);
|
|
78437
78547
|
if (options.isCurrent && !options.isCurrent()) return false;
|
|
78438
78548
|
if (result.success) {
|
|
78439
78549
|
const mention = this.formatMention(result.name, result.fileId);
|
|
@@ -79329,23 +79439,23 @@ var TempImageResources = class {
|
|
|
79329
79439
|
this.directory = mkdtempSync(join19(tmpdir(), "pie-clipboard-"));
|
|
79330
79440
|
if (process.platform !== "win32") chmodSync(this.directory, 448);
|
|
79331
79441
|
}
|
|
79332
|
-
const
|
|
79333
|
-
const fd = openSync2(
|
|
79334
|
-
this.files.add(
|
|
79442
|
+
const path35 = this.injectedPath ? this.injectedPath(ext) : join19(this.directory, `image${ext}`);
|
|
79443
|
+
const fd = openSync2(path35, "wx", 384);
|
|
79444
|
+
this.files.add(path35);
|
|
79335
79445
|
try {
|
|
79336
79446
|
if (process.platform !== "win32") fchmodSync(fd, 384);
|
|
79337
79447
|
} finally {
|
|
79338
79448
|
closeSync2(fd);
|
|
79339
79449
|
}
|
|
79340
|
-
return
|
|
79450
|
+
return path35;
|
|
79341
79451
|
};
|
|
79342
79452
|
cleanup = () => {
|
|
79343
|
-
for (const
|
|
79453
|
+
for (const path35 of this.files) {
|
|
79344
79454
|
try {
|
|
79345
|
-
unlinkSync5(
|
|
79346
|
-
this.files.delete(
|
|
79455
|
+
unlinkSync5(path35);
|
|
79456
|
+
this.files.delete(path35);
|
|
79347
79457
|
} catch (err) {
|
|
79348
|
-
if (err.code === "ENOENT") this.files.delete(
|
|
79458
|
+
if (err.code === "ENOENT") this.files.delete(path35);
|
|
79349
79459
|
}
|
|
79350
79460
|
}
|
|
79351
79461
|
if (this.directory) {
|
|
@@ -79570,20 +79680,20 @@ function writeImageBytes(bytes, declaredMime, mkTempPath) {
|
|
|
79570
79680
|
mimeType
|
|
79571
79681
|
};
|
|
79572
79682
|
}
|
|
79573
|
-
function finalizeTempImage(
|
|
79683
|
+
function finalizeTempImage(path35, mimeType) {
|
|
79574
79684
|
let bytes;
|
|
79575
79685
|
try {
|
|
79576
|
-
if (!existsSync16(
|
|
79686
|
+
if (!existsSync16(path35)) {
|
|
79577
79687
|
return { ok: false, kind: "no-image", message: "Clipboard does not contain an image." };
|
|
79578
79688
|
}
|
|
79579
|
-
const size = statSync12(
|
|
79689
|
+
const size = statSync12(path35).size;
|
|
79580
79690
|
if (size === 0) {
|
|
79581
79691
|
return { ok: false, kind: "no-image", message: "Clipboard does not contain an image." };
|
|
79582
79692
|
}
|
|
79583
79693
|
if (size > MAX_IMAGE_BYTES) {
|
|
79584
79694
|
return { ok: false, kind: "too-large", message: `Clipboard image is too large (${formatBytes2(size)}).` };
|
|
79585
79695
|
}
|
|
79586
|
-
bytes = readFileSync17(
|
|
79696
|
+
bytes = readFileSync17(path35);
|
|
79587
79697
|
} catch (err) {
|
|
79588
79698
|
return { ok: false, kind: "failed", message: `Failed to read clipboard image: ${errorMessage4(err)}` };
|
|
79589
79699
|
}
|
|
@@ -79591,7 +79701,7 @@ function finalizeTempImage(path34, mimeType) {
|
|
|
79591
79701
|
if (!detected) {
|
|
79592
79702
|
return { ok: false, kind: "no-image", message: "Clipboard does not contain a supported image (PNG/JPEG)." };
|
|
79593
79703
|
}
|
|
79594
|
-
return { ok: true, path:
|
|
79704
|
+
return { ok: true, path: path35, mimeType: detected };
|
|
79595
79705
|
}
|
|
79596
79706
|
function detectMimeFromMagic(bytes) {
|
|
79597
79707
|
if (bytes.length >= 8 && bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) {
|
|
@@ -79659,11 +79769,11 @@ function terminalResultToClipboardResult(result) {
|
|
|
79659
79769
|
let dir;
|
|
79660
79770
|
try {
|
|
79661
79771
|
dir = mkdtempSync2(join20(tmpdir2(), "pie-osc5522-"));
|
|
79662
|
-
const
|
|
79663
|
-
writeFileSync10(
|
|
79772
|
+
const path35 = join20(dir, formatPastedImageName(/* @__PURE__ */ new Date(), ext));
|
|
79773
|
+
writeFileSync10(path35, result.bytes);
|
|
79664
79774
|
return {
|
|
79665
79775
|
ok: true,
|
|
79666
|
-
path:
|
|
79776
|
+
path: path35,
|
|
79667
79777
|
mimeType: result.mimeType,
|
|
79668
79778
|
cleanup: () => {
|
|
79669
79779
|
try {
|
|
@@ -80820,11 +80930,11 @@ var HierarchicalSelectorComponent = class extends Container {
|
|
|
80820
80930
|
// src/runtime/interactive-ui-helpers.ts
|
|
80821
80931
|
function showHierarchicalMenu(host, initialPath = []) {
|
|
80822
80932
|
const basePath = [...initialPath];
|
|
80823
|
-
const showAtPath = (
|
|
80933
|
+
const showAtPath = (path35) => {
|
|
80824
80934
|
host.showSelector((done) => {
|
|
80825
80935
|
const selector = new HierarchicalSelectorComponent({
|
|
80826
80936
|
tree: commandTree,
|
|
80827
|
-
path:
|
|
80937
|
+
path: path35,
|
|
80828
80938
|
basePath,
|
|
80829
80939
|
onNavigate: (newPath) => {
|
|
80830
80940
|
done();
|
|
@@ -80832,7 +80942,7 @@ function showHierarchicalMenu(host, initialPath = []) {
|
|
|
80832
80942
|
},
|
|
80833
80943
|
onSelect: async (selectedPath, node, searchArgs) => {
|
|
80834
80944
|
if (node.handler) {
|
|
80835
|
-
const args = searchArgs || (selectedPath.length >
|
|
80945
|
+
const args = searchArgs || (selectedPath.length > path35.length ? selectedPath.slice(path35.length).join(" ") : void 0);
|
|
80836
80946
|
const commandPath = "/" + selectedPath.join("/");
|
|
80837
80947
|
if (!args && host.isInteractiveCommand(commandPath)) {
|
|
80838
80948
|
done();
|
|
@@ -81691,7 +81801,13 @@ async function handleDirectBash(host, command) {
|
|
|
81691
81801
|
const { spawn: spawn5 } = await import("child_process");
|
|
81692
81802
|
const child = spawn5(shellCommand.file, shellCommand.args, {
|
|
81693
81803
|
cwd: process.cwd(),
|
|
81694
|
-
|
|
81804
|
+
// R5-P2: the interactive ! shell is a user-owned context — a pie
|
|
81805
|
+
// started inside it must resolve its OWN defaults, not the manager's
|
|
81806
|
+
// inherited model identity (same boundary as the bash tool).
|
|
81807
|
+
env: (() => {
|
|
81808
|
+
const { PIE_DEFAULT_PROVIDER: _p, PIE_DEFAULT_MODEL: _m, PIE_MANAGER_BOOTSTRAP: _b, PIE_PROC_CURATED_NAME: _c, ...cleanEnv } = process.env;
|
|
81809
|
+
return cleanEnv;
|
|
81810
|
+
})(),
|
|
81695
81811
|
windowsHide: true
|
|
81696
81812
|
});
|
|
81697
81813
|
const output = new DirectBashOutputCollector();
|
|
@@ -82355,17 +82471,17 @@ async function loadInteractiveExtensions(host) {
|
|
|
82355
82471
|
void host.editor.onSubmit(content);
|
|
82356
82472
|
}
|
|
82357
82473
|
},
|
|
82358
|
-
attachLocalFile: async (
|
|
82474
|
+
attachLocalFile: async (path35, displayName) => {
|
|
82359
82475
|
const handler = host.attachmentMentionHandler?.();
|
|
82360
82476
|
if (!handler) return false;
|
|
82361
|
-
return handler.attachLocalFile(
|
|
82477
|
+
return handler.attachLocalFile(path35, displayName);
|
|
82362
82478
|
},
|
|
82363
82479
|
beginUserInput: (isCurrent) => beginUserInput(host, isCurrent),
|
|
82364
|
-
attachLocalFileAndSubmit: async (
|
|
82480
|
+
attachLocalFileAndSubmit: async (path35, displayName, submitText) => {
|
|
82365
82481
|
const scope = beginUserInput(host);
|
|
82366
82482
|
if (!scope) return false;
|
|
82367
82483
|
try {
|
|
82368
|
-
return await scope.submit(submitText, [{ path:
|
|
82484
|
+
return await scope.submit(submitText, [{ path: path35, displayName }]);
|
|
82369
82485
|
} finally {
|
|
82370
82486
|
scope.dispose();
|
|
82371
82487
|
}
|
|
@@ -82487,8 +82603,8 @@ async function loadInteractiveExtensions(host) {
|
|
|
82487
82603
|
host.extensionRunner.setUIContext(host.extensionUIContext);
|
|
82488
82604
|
await restoreExtensionProviderCredentials(host.options.modelRegistry);
|
|
82489
82605
|
if (process.env.PIE_VERBOSE) {
|
|
82490
|
-
for (const { path:
|
|
82491
|
-
console.error(`[Extension] Failed to load ${
|
|
82606
|
+
for (const { path: path35, error } of errors) {
|
|
82607
|
+
console.error(`[Extension] Failed to load ${path35}: ${error}`);
|
|
82492
82608
|
}
|
|
82493
82609
|
}
|
|
82494
82610
|
const policyContext = () => ({
|
|
@@ -82965,7 +83081,7 @@ var InteractiveMode = class {
|
|
|
82965
83081
|
async init() {
|
|
82966
83082
|
const activeSession = this.sessionManager.getActiveSession();
|
|
82967
83083
|
this.thinkingLevel = resolveInitialThinkingLevel({ session: activeSession, settingsManager: this.options.settingsManager });
|
|
82968
|
-
const { Agent } = await import("./chunks/src-
|
|
83084
|
+
const { Agent } = await import("./chunks/src-46R5ZFOU.js");
|
|
82969
83085
|
this.agent = new Agent({
|
|
82970
83086
|
initialState: {
|
|
82971
83087
|
systemPrompt: this.buildSystemPrompt(),
|
|
@@ -83406,8 +83522,30 @@ var InteractiveMode = class {
|
|
|
83406
83522
|
|
|
83407
83523
|
// src/app/runtime-composition.ts
|
|
83408
83524
|
import { existsSync as existsSync17, mkdirSync as mkdirSync11 } from "fs";
|
|
83409
|
-
|
|
83525
|
+
|
|
83526
|
+
// src/app/manager-service-bootstrap.ts
|
|
83527
|
+
import * as fs28 from "fs";
|
|
83410
83528
|
import * as path31 from "path";
|
|
83529
|
+
function applyManagerServiceBootstrapEnv() {
|
|
83530
|
+
if (process.env.PIE_PROC_CURATED_NAME !== "manager") return;
|
|
83531
|
+
if (process.env.PIE_MANAGER_BOOTSTRAP) return;
|
|
83532
|
+
try {
|
|
83533
|
+
const workspaceConfigPath = path31.join(process.cwd(), "config.json");
|
|
83534
|
+
const parsed = JSON.parse(fs28.readFileSync(workspaceConfigPath, "utf8"));
|
|
83535
|
+
const provider = typeof parsed.provider === "string" ? parsed.provider.trim() : "";
|
|
83536
|
+
const modelId = typeof parsed.modelId === "string" ? parsed.modelId.trim() : "";
|
|
83537
|
+
if (provider && modelId) {
|
|
83538
|
+
process.env.PIE_DEFAULT_PROVIDER = provider;
|
|
83539
|
+
process.env.PIE_DEFAULT_MODEL = modelId;
|
|
83540
|
+
process.env.PIE_MANAGER_BOOTSTRAP = "1";
|
|
83541
|
+
}
|
|
83542
|
+
} catch {
|
|
83543
|
+
}
|
|
83544
|
+
}
|
|
83545
|
+
|
|
83546
|
+
// src/app/runtime-composition.ts
|
|
83547
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
83548
|
+
import * as path32 from "path";
|
|
83411
83549
|
var CliMissingApiKeyError = class extends Error {
|
|
83412
83550
|
constructor(message) {
|
|
83413
83551
|
super(message);
|
|
@@ -83428,8 +83566,8 @@ var CliSessionResumeError = class extends Error {
|
|
|
83428
83566
|
function getCliRuntimePaths() {
|
|
83429
83567
|
const configDir = getConfigDir();
|
|
83430
83568
|
const sessionsDir = getSessionsDir();
|
|
83431
|
-
const skillsDir =
|
|
83432
|
-
const builtinSkillsDir =
|
|
83569
|
+
const skillsDir = path32.join(configDir, "skills");
|
|
83570
|
+
const builtinSkillsDir = path32.join(getBuiltinDir(), "skills");
|
|
83433
83571
|
return { configDir, sessionsDir, skillsDir, builtinSkillsDir };
|
|
83434
83572
|
}
|
|
83435
83573
|
function ensureCliRuntimePaths(paths = getCliRuntimePaths()) {
|
|
@@ -83459,6 +83597,7 @@ function createUnconfiguredModel() {
|
|
|
83459
83597
|
async function composeCliRuntime(params) {
|
|
83460
83598
|
const paths = ensureCliRuntimePaths(params.paths);
|
|
83461
83599
|
const compositionTrace = createCliCompositionTrace();
|
|
83600
|
+
applyManagerServiceBootstrapEnv();
|
|
83462
83601
|
const settingsManager = new SettingsManager();
|
|
83463
83602
|
const authStorage = AuthStorage.fromStorage(new FileAuthStorageBackend());
|
|
83464
83603
|
authStorage.setLegacyApiKey(settingsManager.getLegacyApiKey());
|
|
@@ -83549,7 +83688,7 @@ async function composeCliRuntime(params) {
|
|
|
83549
83688
|
fileLogger.log("cli", `Using API key for provider ${provider}`, {
|
|
83550
83689
|
keyPrefix: apiKey ? maskApiKey2(apiKey) : "none"
|
|
83551
83690
|
});
|
|
83552
|
-
const projectSkillsDir =
|
|
83691
|
+
const projectSkillsDir = path32.join(cwd, ".pie", "skills");
|
|
83553
83692
|
const { skills: discoveredSkills, diagnostics } = loadSkills({
|
|
83554
83693
|
dirs: buildSkillDirs({
|
|
83555
83694
|
builtinDir: paths.builtinSkillsDir,
|
|
@@ -83868,7 +84007,7 @@ async function runPrintMode(params) {
|
|
|
83868
84007
|
`);
|
|
83869
84008
|
console.log("Assistant: ");
|
|
83870
84009
|
}
|
|
83871
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
84010
|
+
const { Agent: AgentClass } = await import("./chunks/src-46R5ZFOU.js");
|
|
83872
84011
|
let agent;
|
|
83873
84012
|
const printModeExtensions = await loadPrintModeExtensions({
|
|
83874
84013
|
cwd: runtime.cwd,
|
|
@@ -84453,7 +84592,7 @@ async function loadJsonModeExtensions(params) {
|
|
|
84453
84592
|
// r17 P1: session naming on the resident host — im-forward's explicit
|
|
84454
84593
|
// addressing escape hatch ("<session name>: text") reads the session
|
|
84455
84594
|
// name; without these the json-events host returned undefined and a
|
|
84456
|
-
// cold-started
|
|
84595
|
+
// cold-started manager had NO intake route at all (its route table is
|
|
84457
84596
|
// empty until the first outbound forward, and --idle closes stdin —
|
|
84458
84597
|
// every inbound IM message hit "no route; ignoring" until something
|
|
84459
84598
|
// else happened to make the resident speak first).
|
|
@@ -84533,7 +84672,7 @@ async function loadJsonModeExtensions(params) {
|
|
|
84533
84672
|
if (errors.length) {
|
|
84534
84673
|
await runner.dispose("shutdown");
|
|
84535
84674
|
throw new Error(
|
|
84536
|
-
errors.map(({ path:
|
|
84675
|
+
errors.map(({ path: path35, error }) => `${path35}: ${error}`).join("\n")
|
|
84537
84676
|
);
|
|
84538
84677
|
}
|
|
84539
84678
|
try {
|
|
@@ -85089,7 +85228,7 @@ async function runJsonEventsMode(params) {
|
|
|
85089
85228
|
const sideTrace = trace;
|
|
85090
85229
|
const sideApiKey = runtime.apiKey;
|
|
85091
85230
|
const snapshot = structuredClone(parent.state.messages);
|
|
85092
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
85231
|
+
const { Agent: AgentClass } = await import("./chunks/src-46R5ZFOU.js");
|
|
85093
85232
|
const sideAgent = new AgentClass({
|
|
85094
85233
|
initialState: {
|
|
85095
85234
|
systemPrompt: parent.state.systemPrompt,
|
|
@@ -85639,7 +85778,7 @@ async function runJsonEventsMode(params) {
|
|
|
85639
85778
|
if (runtime.initialModel.unconfigured || controller) {
|
|
85640
85779
|
return;
|
|
85641
85780
|
}
|
|
85642
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
85781
|
+
const { Agent: AgentClass } = await import("./chunks/src-46R5ZFOU.js");
|
|
85643
85782
|
if (runtimeClosing) return;
|
|
85644
85783
|
const compositionRegistry = createCliHostEnvelopeRegistry();
|
|
85645
85784
|
const jsonModeExtensions = await loadJsonModeExtensions({
|
|
@@ -86419,19 +86558,19 @@ async function runJsonEventsMode(params) {
|
|
|
86419
86558
|
}
|
|
86420
86559
|
|
|
86421
86560
|
// src/developer-instructions.ts
|
|
86422
|
-
import * as
|
|
86423
|
-
import * as
|
|
86561
|
+
import * as fs29 from "fs";
|
|
86562
|
+
import * as path33 from "path";
|
|
86424
86563
|
var MAX_DEVELOPER_INSTRUCTIONS_CHARS = 64e3;
|
|
86425
86564
|
function readTextFileBounded(filePath) {
|
|
86426
|
-
const resolved =
|
|
86427
|
-
const stat2 =
|
|
86565
|
+
const resolved = path33.resolve(filePath);
|
|
86566
|
+
const stat2 = fs29.statSync(resolved);
|
|
86428
86567
|
if (!stat2.isFile()) {
|
|
86429
86568
|
throw new Error(`Developer instructions file is not a regular file: ${filePath}`);
|
|
86430
86569
|
}
|
|
86431
86570
|
if (stat2.size > MAX_DEVELOPER_INSTRUCTIONS_CHARS * 4) {
|
|
86432
86571
|
throw new Error(`Developer instructions file is too large: ${filePath}`);
|
|
86433
86572
|
}
|
|
86434
|
-
return
|
|
86573
|
+
return fs29.readFileSync(resolved, "utf8");
|
|
86435
86574
|
}
|
|
86436
86575
|
function collectFlagValues(args, flag) {
|
|
86437
86576
|
const values = [];
|
|
@@ -86550,8 +86689,8 @@ var logError = (msg, err) => {
|
|
|
86550
86689
|
const logPath = getRuntimeLogPath();
|
|
86551
86690
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
86552
86691
|
const stack = err instanceof Error ? err.stack || "" : "";
|
|
86553
|
-
|
|
86554
|
-
|
|
86692
|
+
fs30.mkdirSync(path34.dirname(logPath), { recursive: true });
|
|
86693
|
+
fs30.appendFileSync(logPath, `[${timestamp}] ${msg}
|
|
86555
86694
|
${stack}
|
|
86556
86695
|
|
|
86557
86696
|
`);
|
|
@@ -86566,7 +86705,7 @@ var STABLE_CLI_COMMANDS = {
|
|
|
86566
86705
|
sessions: "sessions",
|
|
86567
86706
|
extensions: "extensions",
|
|
86568
86707
|
permissions: "permissions",
|
|
86569
|
-
|
|
86708
|
+
manager: "manager"
|
|
86570
86709
|
};
|
|
86571
86710
|
async function runWithJsonEventsConsoleIsolation(fn) {
|
|
86572
86711
|
const originalLog = console.log;
|
|
@@ -86586,7 +86725,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
|
|
|
86586
86725
|
}
|
|
86587
86726
|
async function createCliTestStreamFnFromEnv() {
|
|
86588
86727
|
if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
|
|
86589
|
-
return (await import("./chunks/test-stream-
|
|
86728
|
+
return (await import("./chunks/test-stream-FC6ZRENI.js")).createTestStreamFnFromSequenceEnv();
|
|
86590
86729
|
}
|
|
86591
86730
|
function resolveJsonEventsDetailFlag() {
|
|
86592
86731
|
for (let index = 0; index < process.argv.length; index += 1) {
|
|
@@ -86781,10 +86920,10 @@ async function main() {
|
|
|
86781
86920
|
await runMemoryCommand(args.slice(1));
|
|
86782
86921
|
return;
|
|
86783
86922
|
}
|
|
86784
|
-
if (args[0] === STABLE_CLI_COMMANDS.
|
|
86785
|
-
const {
|
|
86923
|
+
if (args[0] === STABLE_CLI_COMMANDS.manager) {
|
|
86924
|
+
const { runManagerCommand } = await import("./chunks/manager-cli-QNMCCIFG.js");
|
|
86786
86925
|
try {
|
|
86787
|
-
await
|
|
86926
|
+
await runManagerCommand(args.slice(1));
|
|
86788
86927
|
} catch (error) {
|
|
86789
86928
|
console.error(error instanceof Error ? error.message : String(error));
|
|
86790
86929
|
process.exitCode = 1;
|