@centralu/darwin-arm64 0.1.0-beta.10

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.
Files changed (87) hide show
  1. package/Centralu.app/Contents/Info.plist +51 -0
  2. package/Centralu.app/Contents/MacOS/centralu +0 -0
  3. package/Centralu.app/Contents/Resources/icon.icns +0 -0
  4. package/Centralu.app/Contents/Resources/resources/host/app-template/AGENTS.md +107 -0
  5. package/Centralu.app/Contents/Resources/resources/host/app-template/CLAUDE.md +1 -0
  6. package/Centralu.app/Contents/Resources/resources/host/app-template/centralu.app.json +9 -0
  7. package/Centralu.app/Contents/Resources/resources/host/app-template/gitattributes +2 -0
  8. package/Centralu.app/Contents/Resources/resources/host/app-template/runtime/THIRD_PARTY_LICENSES.txt +950 -0
  9. package/Centralu.app/Contents/Resources/resources/host/app-template/runtime/centralu-app-runtime.mjs +82 -0
  10. package/Centralu.app/Contents/Resources/resources/host/app-template/runtime/centralu-app-runtime.mjs.map +1 -0
  11. package/Centralu.app/Contents/Resources/resources/host/app-template/runtime/mcp-app.js +104 -0
  12. package/Centralu.app/Contents/Resources/resources/host/app-template/server.mjs +71 -0
  13. package/Centralu.app/Contents/Resources/resources/host/app-template/ui/index.html +105 -0
  14. package/Centralu.app/Contents/Resources/resources/host/bundle-info.json +8 -0
  15. package/Centralu.app/Contents/Resources/resources/host/codex-orchestrator-bridge.mjs +3858 -0
  16. package/Centralu.app/Contents/Resources/resources/host/main.mjs +111554 -0
  17. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  18. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/binding.js +62 -0
  19. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/darwin-arm64.js +3 -0
  20. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/darwin-x64.js +3 -0
  21. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/database.js +109 -0
  22. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/index.js +3 -0
  23. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/linux-arm64.js +3 -0
  24. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/linux-x64.js +3 -0
  25. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/linuxmusl-arm64.js +4 -0
  26. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/linuxmusl-x64.js +4 -0
  27. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
  28. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
  29. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/explain.js +9 -0
  30. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/function.js +31 -0
  31. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
  32. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
  33. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
  34. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/table.js +195 -0
  35. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
  36. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
  37. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/sqlite-error.js +25 -0
  38. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/util.js +12 -0
  39. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/win32-arm64.js +3 -0
  40. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/lib/win32-x64.js +3 -0
  41. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/package.json +67 -0
  42. package/Centralu.app/Contents/Resources/resources/host/node_modules/better-sqlite3/prebuilds/darwin-arm64.node +0 -0
  43. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
  44. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  45. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  46. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
  47. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
  48. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
  49. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/index.js +52 -0
  50. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/index.js.map +1 -0
  51. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/interfaces.js +7 -0
  52. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/interfaces.js.map +1 -0
  53. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/shared/conout.js +11 -0
  54. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/shared/conout.js.map +1 -0
  55. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/terminal.js +190 -0
  56. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/terminal.js.map +1 -0
  57. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/terminal.test.js +139 -0
  58. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/terminal.test.js.map +1 -0
  59. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/testUtils.test.js +28 -0
  60. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
  61. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/types.js +7 -0
  62. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/types.js.map +1 -0
  63. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/unixTerminal.js +346 -0
  64. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
  65. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
  66. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
  67. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/utils.js +39 -0
  68. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/utils.js.map +1 -0
  69. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  70. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
  71. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  72. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
  73. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
  74. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
  75. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  76. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
  77. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
  78. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
  79. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  80. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  81. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/package.json +64 -0
  82. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  83. package/Centralu.app/Contents/Resources/resources/host/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  84. package/Centralu.app/Contents/Resources/resources/host/schema.sql +94 -0
  85. package/Centralu.app/Contents/_CodeSignature/CodeResources +1019 -0
  86. package/README.md +7 -0
  87. package/package.json +21 -0
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2017, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var fs = require("fs");
8
+ var assert = require("assert");
9
+ var windowsTerminal_1 = require("./windowsTerminal");
10
+ var path = require("path");
11
+ var psList = require("ps-list");
12
+ function pollForProcessState(desiredState, intervalMs, timeoutMs) {
13
+ if (intervalMs === void 0) { intervalMs = 100; }
14
+ if (timeoutMs === void 0) { timeoutMs = 2000; }
15
+ return new Promise(function (resolve) {
16
+ var tries = 0;
17
+ var interval = setInterval(function () {
18
+ psList({ all: true }).then(function (ps) {
19
+ var success = true;
20
+ var pids = Object.keys(desiredState).map(function (k) { return parseInt(k, 10); });
21
+ console.log('expected pids', JSON.stringify(pids));
22
+ pids.forEach(function (pid) {
23
+ if (desiredState[pid]) {
24
+ if (!ps.some(function (p) { return p.pid === pid; })) {
25
+ console.log("pid " + pid + " does not exist");
26
+ success = false;
27
+ }
28
+ }
29
+ else {
30
+ if (ps.some(function (p) { return p.pid === pid; })) {
31
+ console.log("pid " + pid + " still exists");
32
+ success = false;
33
+ }
34
+ }
35
+ });
36
+ if (success) {
37
+ clearInterval(interval);
38
+ resolve();
39
+ return;
40
+ }
41
+ tries++;
42
+ if (tries * intervalMs >= timeoutMs) {
43
+ clearInterval(interval);
44
+ var processListing = pids.map(function (k) { return k + ": " + desiredState[k]; }).join('\n');
45
+ assert.fail("Bad process state, expected:\n" + processListing);
46
+ resolve();
47
+ }
48
+ });
49
+ }, intervalMs);
50
+ });
51
+ }
52
+ function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) {
53
+ if (intervalMs === void 0) { intervalMs = 100; }
54
+ if (timeoutMs === void 0) { timeoutMs = 2000; }
55
+ return new Promise(function (resolve) {
56
+ var tries = 0;
57
+ var interval = setInterval(function () {
58
+ psList({ all: true }).then(function (ps) {
59
+ var openList = [];
60
+ openList.push(ps.filter(function (p) { return p.pid === pid; }).map(function (p) {
61
+ return { name: p.name, pid: p.pid };
62
+ })[0]);
63
+ var list = [];
64
+ var _loop_1 = function () {
65
+ var current = openList.shift();
66
+ ps.filter(function (p) { return p.ppid === current.pid; }).map(function (p) {
67
+ return { name: p.name, pid: p.pid };
68
+ }).forEach(function (p) { return openList.push(p); });
69
+ list.push(current);
70
+ };
71
+ while (openList.length) {
72
+ _loop_1();
73
+ }
74
+ console.log('list', JSON.stringify(list));
75
+ var success = list.length === size;
76
+ if (success) {
77
+ clearInterval(interval);
78
+ resolve(list);
79
+ return;
80
+ }
81
+ tries++;
82
+ if (tries * intervalMs >= timeoutMs) {
83
+ clearInterval(interval);
84
+ assert.fail("Bad process state, expected: " + size + ", actual: " + list.length);
85
+ }
86
+ });
87
+ }, intervalMs);
88
+ });
89
+ }
90
+ if (process.platform === 'win32') {
91
+ [[false, false], [true, false], [true, true]].forEach(function (_a) {
92
+ var useConpty = _a[0], useConptyDll = _a[1];
93
+ describe("WindowsTerminal (useConpty = " + useConpty + ", useConptyDll = " + useConptyDll + ")", function () {
94
+ describe('kill', function () {
95
+ it('should not crash parent process', function (done) {
96
+ this.timeout(20000);
97
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
98
+ term.on('exit', function () { return done(); });
99
+ term.kill();
100
+ });
101
+ it('should kill the process tree', function (done) {
102
+ this.timeout(20000);
103
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
104
+ // Start sub-processes
105
+ term.write('powershell.exe\r');
106
+ term.write('node.exe\r');
107
+ console.log('start poll for tree size');
108
+ pollForProcessTreeSize(term.pid, 3, 500, 5000).then(function (list) {
109
+ assert.strictEqual(list[0].name.toLowerCase(), 'cmd.exe');
110
+ assert.strictEqual(list[1].name.toLowerCase(), 'powershell.exe');
111
+ assert.strictEqual(list[2].name.toLowerCase(), 'node.exe');
112
+ term.kill();
113
+ var desiredState = {};
114
+ desiredState[list[0].pid] = false;
115
+ desiredState[list[1].pid] = false;
116
+ desiredState[list[2].pid] = false;
117
+ term.on('exit', function () {
118
+ pollForProcessState(desiredState, 1000, 5000).then(function () {
119
+ done();
120
+ });
121
+ });
122
+ });
123
+ });
124
+ });
125
+ describe('resize', function () {
126
+ it('should throw a non-native exception when resizing an invalid value', function (done) {
127
+ this.timeout(20000);
128
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
129
+ assert.throws(function () { return term.resize(-1, -1); });
130
+ assert.throws(function () { return term.resize(0, 0); });
131
+ assert.doesNotThrow(function () { return term.resize(1, 1); });
132
+ term.on('exit', function () {
133
+ done();
134
+ });
135
+ term.kill();
136
+ });
137
+ it('should throw a non-native exception when resizing a killed terminal', function (done) {
138
+ this.timeout(20000);
139
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
140
+ term._defer(function () {
141
+ term.once('exit', function () {
142
+ assert.throws(function () { return term.resize(1, 1); });
143
+ done();
144
+ });
145
+ term.destroy();
146
+ });
147
+ });
148
+ });
149
+ describe('Args as CommandLine', function () {
150
+ it('should not fail running a file containing a space in the path', function (done) {
151
+ this.timeout(10000);
152
+ var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
153
+ if (!fs.existsSync(spaceFolder)) {
154
+ fs.mkdirSync(spaceFolder);
155
+ }
156
+ var cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe');
157
+ var data = fs.readFileSync(process.env.windir + "\\System32\\cmd.exe");
158
+ fs.writeFileSync(cmdCopiedPath, data);
159
+ if (!fs.existsSync(cmdCopiedPath)) {
160
+ // Skip test if git bash isn't installed
161
+ return;
162
+ }
163
+ var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty: useConpty, useConptyDll: useConptyDll });
164
+ var result = '';
165
+ term.on('data', function (data) {
166
+ result += data;
167
+ });
168
+ term.on('exit', function () {
169
+ assert.ok(result.indexOf('hello world') >= 1);
170
+ done();
171
+ });
172
+ });
173
+ });
174
+ describe('env', function () {
175
+ it('should set environment variables of the shell', function (done) {
176
+ this.timeout(10000);
177
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { useConpty: useConpty, useConptyDll: useConptyDll, env: { FOO: 'BAR' } });
178
+ var result = '';
179
+ term.on('data', function (data) {
180
+ result += data;
181
+ });
182
+ term.on('exit', function () {
183
+ assert.ok(result.indexOf('BAR') >= 0);
184
+ done();
185
+ });
186
+ });
187
+ });
188
+ describe('On close', function () {
189
+ it('should return process zero exit codes', function (done) {
190
+ this.timeout(10000);
191
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit', { useConpty: useConpty, useConptyDll: useConptyDll });
192
+ term.on('exit', function (code) {
193
+ assert.strictEqual(code, 0);
194
+ done();
195
+ });
196
+ });
197
+ it('should return process non-zero exit codes', function (done) {
198
+ this.timeout(10000);
199
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2', { useConpty: useConpty, useConptyDll: useConptyDll });
200
+ term.on('exit', function (code) {
201
+ assert.strictEqual(code, 2);
202
+ done();
203
+ });
204
+ });
205
+ });
206
+ describe('Write', function () {
207
+ it('should accept input', function (done) {
208
+ this.timeout(10000);
209
+ var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '', { useConpty: useConpty, useConptyDll: useConptyDll });
210
+ term.write('exit\r');
211
+ term.on('exit', function () {
212
+ done();
213
+ });
214
+ });
215
+ });
216
+ });
217
+ });
218
+ }
219
+ //# sourceMappingURL=windowsTerminal.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windowsTerminal.test.js","sourceRoot":"","sources":["../src/windowsTerminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,uBAAyB;AACzB,+BAAiC;AACjC,qDAAoD;AACpD,2BAA6B;AAC7B,gCAAkC;AAYlC,SAAS,mBAAmB,CAAC,YAA2B,EAAE,UAAwB,EAAE,SAAwB;IAAlD,2BAAA,EAAA,gBAAwB;IAAE,0BAAA,EAAA,gBAAwB;IAC1G,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,EAAE;gBAC3B,IAAI,OAAO,GAAG,IAAI,CAAC;gBACnB,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,EAAf,CAAe,CAAC,CAAC;gBACjE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBACd,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;wBACrB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC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D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACpB,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,WAAW,EAAE,EAAE,SAAS,WAAA,EAAE,YAAY,cAAA,EAAE,CAAC,CAAC;oBACtF,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;wBACnB,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;wBAC5B,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,EAAE;gBAChB,EAAE,CAAC,qBAAqB,EAAE,UAAU,IAAI;oBACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACpB,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,WAAA,EAAE,YAAY,cAAA,EAAE,CAAC,CAAC;oBAC7E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBACrB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;wBACd,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020, Microsoft Corporation (MIT License).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var worker_threads_1 = require("worker_threads");
7
+ var net_1 = require("net");
8
+ var conout_1 = require("../shared/conout");
9
+ var conoutPipeName = worker_threads_1.workerData.conoutPipeName;
10
+ var conoutSocket = new net_1.Socket();
11
+ conoutSocket.setEncoding('utf8');
12
+ conoutSocket.connect(conoutPipeName, function () {
13
+ var server = net_1.createServer(function (workerSocket) {
14
+ conoutSocket.pipe(workerSocket);
15
+ });
16
+ server.listen(conout_1.getWorkerPipeName(conoutPipeName));
17
+ if (!worker_threads_1.parentPort) {
18
+ throw new Error('worker_threads parentPort is null');
19
+ }
20
+ worker_threads_1.parentPort.postMessage(1 /* READY */);
21
+ });
22
+ //# sourceMappingURL=conoutSocketWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conoutSocketWorker.js","sourceRoot":"","sources":["../../src/worker/conoutSocketWorker.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,iDAAwD;AACxD,2BAA2C;AAC3C,2CAAuF;AAE/E,IAAA,cAAc,GAAM,2BAA0B,eAAhC,CAAiC;AAEvD,IAAM,YAAY,GAAG,IAAI,YAAM,EAAE,CAAC;AAClC,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE;IACnC,IAAM,MAAM,GAAG,kBAAY,CAAC,UAAA,YAAY;QACtC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,0BAAiB,CAAC,cAAc,CAAC,CAAC,CAAC;IACjD,IAAI,CAAC,2BAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IACD,2BAAU,CAAC,WAAW,eAA2B,CAAC;AACpD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "node-pty",
3
+ "description": "Fork pseudoterminals in Node.JS",
4
+ "author": {
5
+ "name": "Microsoft Corporation"
6
+ },
7
+ "version": "1.1.0",
8
+ "license": "MIT",
9
+ "main": "./lib/index.js",
10
+ "types": "./typings/node-pty.d.ts",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git://github.com/microsoft/node-pty.git"
14
+ },
15
+ "files": [
16
+ "binding.gyp",
17
+ "lib/",
18
+ "scripts/",
19
+ "src/",
20
+ "deps/",
21
+ "prebuilds/",
22
+ "third_party/",
23
+ "typings/"
24
+ ],
25
+ "homepage": "https://github.com/microsoft/node-pty",
26
+ "bugs": {
27
+ "url": "https://github.com/microsoft/node-pty/issues"
28
+ },
29
+ "keywords": [
30
+ "pty",
31
+ "tty",
32
+ "terminal",
33
+ "pseudoterminal",
34
+ "forkpty",
35
+ "openpty"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsc -b ./src/tsconfig.json",
39
+ "watch": "tsc -b -w ./src/tsconfig.json",
40
+ "lint": "eslint -c .eslintrc.js --ext .ts src/",
41
+ "install": "node scripts/prebuild.js || node-gyp rebuild",
42
+ "postinstall": "node scripts/post-install.js",
43
+ "compileCommands": "node scripts/gen-compile-commands.js",
44
+ "test": "cross-env NODE_ENV=test mocha -R spec --exit lib/*.test.js",
45
+ "posttest": "npm run lint",
46
+ "prepare": "npm run build",
47
+ "prepublishOnly": "npm run build"
48
+ },
49
+ "dependencies": {
50
+ "node-addon-api": "^7.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@types/mocha": "^7.0.2",
54
+ "@types/node": "12",
55
+ "@typescript-eslint/eslint-plugin": "^2.27.0",
56
+ "@typescript-eslint/parser": "^2.27.0",
57
+ "cross-env": "^5.1.4",
58
+ "eslint": "^6.8.0",
59
+ "mocha": "10",
60
+ "node-gyp": "^11.4.2",
61
+ "ps-list": "^6.0.0",
62
+ "typescript": "^3.8.3"
63
+ }
64
+ }
@@ -0,0 +1,94 @@
1
+ -- Centralu local storage schema v1
2
+ -- Read by the host (better-sqlite3). Migrations are handled by the steps in dev-services/store.ts.
3
+ --
4
+ -- **user_version is never set here.** This file runs every time the database is opened (safe,
5
+ -- since every table uses CREATE IF NOT EXISTS), so if `PRAGMA user_version = 1` were here, a
6
+ -- database already at v27 would reset to 1 on every open and **rerun all 26 migrations**.
7
+ -- Measured (2026-09-02, store.db at 94MB, 66,700 messages): 4.4 to 5.0 seconds per open, of
8
+ -- which v3 (1.4s), v11 (1.7s) and v21 (1.7s) were each a full table scan — a startup cost that
9
+ -- only grows as the conversation history piles up.
10
+ --
11
+ -- Leaving the value unset entirely means a new database starts at 0 and runs every step once
12
+ -- (the same as before), while an existing database keeps whatever number the last step left
13
+ -- behind, so nothing reruns.
14
+
15
+ CREATE TABLE IF NOT EXISTS projects (
16
+ id TEXT PRIMARY KEY,
17
+ path TEXT NOT NULL UNIQUE,
18
+ name TEXT NOT NULL,
19
+ default_tool TEXT NOT NULL DEFAULT 'claude',
20
+ -- The default model and effort per tool (#107): {"codex":{"model":"gpt-5.6","effort":"high"}, ...}.
21
+ -- This is where the scalars default_model/default_effort used to be — a model name is a tool's
22
+ -- own vocabulary, so remembering a single one with no tool attached meant a session for a
23
+ -- different tool inherited that name and died on its first turn.
24
+ default_models TEXT,
25
+ sidebar_order INTEGER NOT NULL DEFAULT 0,
26
+ created_at INTEGER NOT NULL
27
+ );
28
+
29
+ CREATE TABLE IF NOT EXISTS sessions (
30
+ id TEXT PRIMARY KEY,
31
+ -- The orchestrator does not belong to any project (one per app, crossing all projects).
32
+ -- Making this NOT NULL would force it to hang off some project, and deleting that project
33
+ -- would kill it too via CASCADE.
34
+ project_id TEXT REFERENCES projects(id) ON DELETE CASCADE,
35
+ tool TEXT NOT NULL,
36
+ external_id TEXT,
37
+ name TEXT NOT NULL,
38
+ auto_named INTEGER NOT NULL DEFAULT 1,
39
+ state TEXT NOT NULL DEFAULT 'idle',
40
+ is_orchestrator INTEGER NOT NULL DEFAULT 0,
41
+ last_read_seq INTEGER NOT NULL DEFAULT 0,
42
+ waiting_since INTEGER,
43
+ created_at INTEGER NOT NULL
44
+ );
45
+ CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project_id);
46
+
47
+ CREATE TABLE IF NOT EXISTS messages (
48
+ session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
49
+ seq INTEGER NOT NULL,
50
+ role TEXT NOT NULL,
51
+ kind TEXT NOT NULL,
52
+ payload TEXT NOT NULL,
53
+ ts INTEGER NOT NULL,
54
+ PRIMARY KEY (session_id, seq)
55
+ );
56
+
57
+ -- "Always allow" rules (FR-3). Uses session_id when scope=session, project_id when scope=project
58
+ CREATE TABLE IF NOT EXISTS approval_rules (
59
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
60
+ scope TEXT NOT NULL,
61
+ project_id TEXT,
62
+ session_id TEXT,
63
+ matcher TEXT NOT NULL,
64
+ decision TEXT NOT NULL,
65
+ created_at INTEGER NOT NULL
66
+ );
67
+
68
+ CREATE TABLE IF NOT EXISTS usage_facts (
69
+ date TEXT NOT NULL,
70
+ tool TEXT NOT NULL,
71
+ model TEXT NOT NULL,
72
+ project_id TEXT,
73
+ input_tokens INTEGER NOT NULL DEFAULT 0,
74
+ output_tokens INTEGER NOT NULL DEFAULT 0,
75
+ cache_tokens INTEGER NOT NULL DEFAULT 0,
76
+ cost_est REAL NOT NULL DEFAULT 0,
77
+ PRIMARY KEY (date, tool, model, project_id)
78
+ );
79
+
80
+ CREATE TABLE IF NOT EXISTS workspace (
81
+ id INTEGER PRIMARY KEY CHECK (id = 1),
82
+ layout TEXT NOT NULL,
83
+ updated_at INTEGER NOT NULL
84
+ );
85
+
86
+ -- Commit attribution (#50): which session made this commit — recorded only here, never in the repository.
87
+ -- The hash is picked up from the agent's git commit tool output, so it can be short (matched by prefix).
88
+ CREATE TABLE IF NOT EXISTS commit_sessions (
89
+ project_id TEXT NOT NULL,
90
+ sha TEXT NOT NULL,
91
+ session_id TEXT NOT NULL,
92
+ ts INTEGER NOT NULL,
93
+ PRIMARY KEY (project_id, sha)
94
+ );