@promptframe/creation 0.3.13 → 0.3.15
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/cli.mjs +261 -119
- package/docs/install-guidance.json +1 -1
- package/docs/installing.md +6 -4
- package/lib/antigravity-host-session.mjs +76 -25
- package/lib/antigravity-installation.mjs +91 -14
- package/lib/cli.mjs +8 -4
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
- package/skills/creation-setup/SKILL.md +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -407,11 +407,11 @@ var require_codegen = __commonJS({
|
|
|
407
407
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
408
408
|
return `${varKind} ${this.name}${rhs};` + _n2;
|
|
409
409
|
}
|
|
410
|
-
optimizeNames(names,
|
|
410
|
+
optimizeNames(names, constants10) {
|
|
411
411
|
if (!names[this.name.str])
|
|
412
412
|
return;
|
|
413
413
|
if (this.rhs)
|
|
414
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
414
|
+
this.rhs = optimizeExpr(this.rhs, names, constants10);
|
|
415
415
|
return this;
|
|
416
416
|
}
|
|
417
417
|
get names() {
|
|
@@ -428,10 +428,10 @@ var require_codegen = __commonJS({
|
|
|
428
428
|
render({ _n: _n2 }) {
|
|
429
429
|
return `${this.lhs} = ${this.rhs};` + _n2;
|
|
430
430
|
}
|
|
431
|
-
optimizeNames(names,
|
|
431
|
+
optimizeNames(names, constants10) {
|
|
432
432
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
433
433
|
return;
|
|
434
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
434
|
+
this.rhs = optimizeExpr(this.rhs, names, constants10);
|
|
435
435
|
return this;
|
|
436
436
|
}
|
|
437
437
|
get names() {
|
|
@@ -492,8 +492,8 @@ var require_codegen = __commonJS({
|
|
|
492
492
|
optimizeNodes() {
|
|
493
493
|
return `${this.code}` ? this : void 0;
|
|
494
494
|
}
|
|
495
|
-
optimizeNames(names,
|
|
496
|
-
this.code = optimizeExpr(this.code, names,
|
|
495
|
+
optimizeNames(names, constants10) {
|
|
496
|
+
this.code = optimizeExpr(this.code, names, constants10);
|
|
497
497
|
return this;
|
|
498
498
|
}
|
|
499
499
|
get names() {
|
|
@@ -522,12 +522,12 @@ var require_codegen = __commonJS({
|
|
|
522
522
|
}
|
|
523
523
|
return nodes.length > 0 ? this : void 0;
|
|
524
524
|
}
|
|
525
|
-
optimizeNames(names,
|
|
525
|
+
optimizeNames(names, constants10) {
|
|
526
526
|
const { nodes } = this;
|
|
527
527
|
let i = nodes.length;
|
|
528
528
|
while (i--) {
|
|
529
529
|
const n = nodes[i];
|
|
530
|
-
if (n.optimizeNames(names,
|
|
530
|
+
if (n.optimizeNames(names, constants10))
|
|
531
531
|
continue;
|
|
532
532
|
subtractNames(names, n.names);
|
|
533
533
|
nodes.splice(i, 1);
|
|
@@ -580,12 +580,12 @@ var require_codegen = __commonJS({
|
|
|
580
580
|
return void 0;
|
|
581
581
|
return this;
|
|
582
582
|
}
|
|
583
|
-
optimizeNames(names,
|
|
583
|
+
optimizeNames(names, constants10) {
|
|
584
584
|
var _a3;
|
|
585
|
-
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
586
|
-
if (!(super.optimizeNames(names,
|
|
585
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants10);
|
|
586
|
+
if (!(super.optimizeNames(names, constants10) || this.else))
|
|
587
587
|
return;
|
|
588
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
588
|
+
this.condition = optimizeExpr(this.condition, names, constants10);
|
|
589
589
|
return this;
|
|
590
590
|
}
|
|
591
591
|
get names() {
|
|
@@ -608,10 +608,10 @@ var require_codegen = __commonJS({
|
|
|
608
608
|
render(opts) {
|
|
609
609
|
return `for(${this.iteration})` + super.render(opts);
|
|
610
610
|
}
|
|
611
|
-
optimizeNames(names,
|
|
612
|
-
if (!super.optimizeNames(names,
|
|
611
|
+
optimizeNames(names, constants10) {
|
|
612
|
+
if (!super.optimizeNames(names, constants10))
|
|
613
613
|
return;
|
|
614
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
614
|
+
this.iteration = optimizeExpr(this.iteration, names, constants10);
|
|
615
615
|
return this;
|
|
616
616
|
}
|
|
617
617
|
get names() {
|
|
@@ -647,10 +647,10 @@ var require_codegen = __commonJS({
|
|
|
647
647
|
render(opts) {
|
|
648
648
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
649
649
|
}
|
|
650
|
-
optimizeNames(names,
|
|
651
|
-
if (!super.optimizeNames(names,
|
|
650
|
+
optimizeNames(names, constants10) {
|
|
651
|
+
if (!super.optimizeNames(names, constants10))
|
|
652
652
|
return;
|
|
653
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
653
|
+
this.iterable = optimizeExpr(this.iterable, names, constants10);
|
|
654
654
|
return this;
|
|
655
655
|
}
|
|
656
656
|
get names() {
|
|
@@ -692,11 +692,11 @@ var require_codegen = __commonJS({
|
|
|
692
692
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
693
693
|
return this;
|
|
694
694
|
}
|
|
695
|
-
optimizeNames(names,
|
|
695
|
+
optimizeNames(names, constants10) {
|
|
696
696
|
var _a3, _b;
|
|
697
|
-
super.optimizeNames(names,
|
|
698
|
-
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
699
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
697
|
+
super.optimizeNames(names, constants10);
|
|
698
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants10);
|
|
699
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants10);
|
|
700
700
|
return this;
|
|
701
701
|
}
|
|
702
702
|
get names() {
|
|
@@ -997,7 +997,7 @@ var require_codegen = __commonJS({
|
|
|
997
997
|
function addExprNames(names, from) {
|
|
998
998
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
999
999
|
}
|
|
1000
|
-
function optimizeExpr(expr, names,
|
|
1000
|
+
function optimizeExpr(expr, names, constants10) {
|
|
1001
1001
|
if (expr instanceof code_1.Name)
|
|
1002
1002
|
return replaceName(expr);
|
|
1003
1003
|
if (!canOptimize(expr))
|
|
@@ -1012,14 +1012,14 @@ var require_codegen = __commonJS({
|
|
|
1012
1012
|
return items;
|
|
1013
1013
|
}, []));
|
|
1014
1014
|
function replaceName(n) {
|
|
1015
|
-
const c =
|
|
1015
|
+
const c = constants10[n.str];
|
|
1016
1016
|
if (c === void 0 || names[n.str] !== 1)
|
|
1017
1017
|
return n;
|
|
1018
1018
|
delete names[n.str];
|
|
1019
1019
|
return c;
|
|
1020
1020
|
}
|
|
1021
1021
|
function canOptimize(e) {
|
|
1022
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
1022
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants10[c.str] !== void 0);
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
function subtractNames(names, from) {
|
|
@@ -8429,7 +8429,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8429
8429
|
}
|
|
8430
8430
|
|
|
8431
8431
|
// lib/version.mjs
|
|
8432
|
-
var CLIENT_VERSION = "0.3.
|
|
8432
|
+
var CLIENT_VERSION = "0.3.15";
|
|
8433
8433
|
var CLIENT_PROTOCOL = "creation-client/v1";
|
|
8434
8434
|
|
|
8435
8435
|
// lib/cli.mjs
|
|
@@ -8579,9 +8579,9 @@ function floatSafeRemainder(val, step) {
|
|
|
8579
8579
|
return ratio - roundedRatio;
|
|
8580
8580
|
}
|
|
8581
8581
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
8582
|
-
function defineLazy(
|
|
8582
|
+
function defineLazy(object4, key, getter) {
|
|
8583
8583
|
let value2 = void 0;
|
|
8584
|
-
Object.defineProperty(
|
|
8584
|
+
Object.defineProperty(object4, key, {
|
|
8585
8585
|
get() {
|
|
8586
8586
|
if (value2 === EVALUATING) {
|
|
8587
8587
|
return void 0;
|
|
@@ -8593,7 +8593,7 @@ function defineLazy(object3, key, getter) {
|
|
|
8593
8593
|
return value2;
|
|
8594
8594
|
},
|
|
8595
8595
|
set(v2) {
|
|
8596
|
-
Object.defineProperty(
|
|
8596
|
+
Object.defineProperty(object4, key, {
|
|
8597
8597
|
value: v2
|
|
8598
8598
|
// configurable: true,
|
|
8599
8599
|
});
|
|
@@ -13073,8 +13073,8 @@ function foldObjects(members2) {
|
|
|
13073
13073
|
}
|
|
13074
13074
|
const properties = {};
|
|
13075
13075
|
const required2 = /* @__PURE__ */ new Set();
|
|
13076
|
-
for (const
|
|
13077
|
-
for (const key in
|
|
13076
|
+
for (const object4 of objects) {
|
|
13077
|
+
for (const key in object4.properties) {
|
|
13078
13078
|
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
13079
13079
|
continue;
|
|
13080
13080
|
const parts = [];
|
|
@@ -13088,18 +13088,18 @@ function foldObjects(members2) {
|
|
|
13088
13088
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
13089
13089
|
assignProp(properties, key, merged);
|
|
13090
13090
|
}
|
|
13091
|
-
for (const key of
|
|
13091
|
+
for (const key of object4.required ?? [])
|
|
13092
13092
|
required2.add(key);
|
|
13093
13093
|
}
|
|
13094
13094
|
const folded = { type: "object", properties };
|
|
13095
13095
|
if (required2.size)
|
|
13096
13096
|
folded.required = [...required2];
|
|
13097
|
-
if (objects.every((
|
|
13097
|
+
if (objects.every((object4) => object4.additionalProperties === false)) {
|
|
13098
13098
|
folded.additionalProperties = false;
|
|
13099
13099
|
} else {
|
|
13100
13100
|
const constraints = [];
|
|
13101
|
-
for (const
|
|
13102
|
-
const constraint = undeclaredConstraint(
|
|
13101
|
+
for (const object4 of objects) {
|
|
13102
|
+
const constraint = undeclaredConstraint(object4);
|
|
13103
13103
|
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
13104
13104
|
constraints.push(constraint);
|
|
13105
13105
|
}
|
|
@@ -16913,14 +16913,14 @@ var Protocol = class {
|
|
|
16913
16913
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
16914
16914
|
const capturedTransport = this._transport;
|
|
16915
16915
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
16916
|
-
const
|
|
16916
|
+
const sessionId2 = capturedTransport?.sessionId;
|
|
16917
16917
|
const store = this._taskStore;
|
|
16918
16918
|
let relatedTaskFound = true;
|
|
16919
16919
|
let relatedTaskLookup;
|
|
16920
|
-
if (relatedTaskId && store && this._taskMessageQueue &&
|
|
16920
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId2 !== void 0) {
|
|
16921
16921
|
relatedTaskFound = false;
|
|
16922
16922
|
relatedTaskLookup = (async () => {
|
|
16923
|
-
if (!await store.getTask(relatedTaskId,
|
|
16923
|
+
if (!await store.getTask(relatedTaskId, sessionId2)) {
|
|
16924
16924
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
16925
16925
|
}
|
|
16926
16926
|
relatedTaskFound = true;
|
|
@@ -16937,7 +16937,7 @@ var Protocol = class {
|
|
|
16937
16937
|
};
|
|
16938
16938
|
if (relatedTaskId && relatedTaskLookup) {
|
|
16939
16939
|
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
16940
|
-
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError,
|
|
16940
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId2), () => capturedTransport?.send(errorResponse)).catch((error6) => this._onerror(new Error(`Failed to send an error response: ${error6}`)));
|
|
16941
16941
|
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
16942
16942
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
16943
16943
|
type: "error",
|
|
@@ -17502,21 +17502,21 @@ var Protocol = class {
|
|
|
17502
17502
|
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
|
17503
17503
|
* simply propagates the error.
|
|
17504
17504
|
*/
|
|
17505
|
-
async _enqueueTaskMessage(taskId, message,
|
|
17505
|
+
async _enqueueTaskMessage(taskId, message, sessionId2) {
|
|
17506
17506
|
if (!this._taskStore || !this._taskMessageQueue) {
|
|
17507
17507
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
17508
17508
|
}
|
|
17509
17509
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
17510
|
-
await this._taskMessageQueue.enqueue(taskId, message,
|
|
17510
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId2 ?? this._transport?.sessionId, maxQueueSize);
|
|
17511
17511
|
}
|
|
17512
17512
|
/**
|
|
17513
17513
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
17514
17514
|
* @param taskId The task ID whose queue should be cleared
|
|
17515
17515
|
* @param sessionId Optional session ID for binding the operation to a specific session
|
|
17516
17516
|
*/
|
|
17517
|
-
async _clearTaskQueue(taskId,
|
|
17517
|
+
async _clearTaskQueue(taskId, sessionId2) {
|
|
17518
17518
|
if (this._taskMessageQueue) {
|
|
17519
|
-
const messages = await this._taskMessageQueue.dequeueAll(taskId,
|
|
17519
|
+
const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId2);
|
|
17520
17520
|
for (const message of messages) {
|
|
17521
17521
|
if (message.type === "request" && isJSONRPCRequest(message.message)) {
|
|
17522
17522
|
const requestId = message.message.id;
|
|
@@ -17539,10 +17539,10 @@ var Protocol = class {
|
|
|
17539
17539
|
* @param sessionId Session of the request that waits, passed to the task store
|
|
17540
17540
|
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
17541
17541
|
*/
|
|
17542
|
-
async _waitForTaskUpdate(taskId, signal,
|
|
17542
|
+
async _waitForTaskUpdate(taskId, signal, sessionId2) {
|
|
17543
17543
|
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
17544
17544
|
try {
|
|
17545
|
-
const task = await this._taskStore?.getTask(taskId,
|
|
17545
|
+
const task = await this._taskStore?.getTask(taskId, sessionId2);
|
|
17546
17546
|
if (task?.pollInterval) {
|
|
17547
17547
|
interval = task.pollInterval;
|
|
17548
17548
|
}
|
|
@@ -17560,7 +17560,7 @@ var Protocol = class {
|
|
|
17560
17560
|
}, { once: true });
|
|
17561
17561
|
});
|
|
17562
17562
|
}
|
|
17563
|
-
requestTaskStore(request,
|
|
17563
|
+
requestTaskStore(request, sessionId2) {
|
|
17564
17564
|
const taskStore = this._taskStore;
|
|
17565
17565
|
if (!taskStore) {
|
|
17566
17566
|
throw new Error("No task store configured");
|
|
@@ -17573,18 +17573,18 @@ var Protocol = class {
|
|
|
17573
17573
|
return await taskStore.createTask(taskParams, request.id, {
|
|
17574
17574
|
method: request.method,
|
|
17575
17575
|
params: request.params
|
|
17576
|
-
},
|
|
17576
|
+
}, sessionId2);
|
|
17577
17577
|
},
|
|
17578
17578
|
getTask: async (taskId) => {
|
|
17579
|
-
const task = await taskStore.getTask(taskId,
|
|
17579
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
17580
17580
|
if (!task) {
|
|
17581
17581
|
throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
|
|
17582
17582
|
}
|
|
17583
17583
|
return task;
|
|
17584
17584
|
},
|
|
17585
17585
|
storeTaskResult: async (taskId, status, result) => {
|
|
17586
|
-
await taskStore.storeTaskResult(taskId, status, result,
|
|
17587
|
-
const task = await taskStore.getTask(taskId,
|
|
17586
|
+
await taskStore.storeTaskResult(taskId, status, result, sessionId2);
|
|
17587
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
17588
17588
|
if (task) {
|
|
17589
17589
|
const notification = TaskStatusNotificationSchema.parse({
|
|
17590
17590
|
method: "notifications/tasks/status",
|
|
@@ -17597,18 +17597,18 @@ var Protocol = class {
|
|
|
17597
17597
|
}
|
|
17598
17598
|
},
|
|
17599
17599
|
getTaskResult: (taskId) => {
|
|
17600
|
-
return taskStore.getTaskResult(taskId,
|
|
17600
|
+
return taskStore.getTaskResult(taskId, sessionId2);
|
|
17601
17601
|
},
|
|
17602
17602
|
updateTaskStatus: async (taskId, status, statusMessage) => {
|
|
17603
|
-
const task = await taskStore.getTask(taskId,
|
|
17603
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
17604
17604
|
if (!task) {
|
|
17605
17605
|
throw new McpError(ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`);
|
|
17606
17606
|
}
|
|
17607
17607
|
if (isTerminal(task.status)) {
|
|
17608
17608
|
throw new McpError(ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
|
|
17609
17609
|
}
|
|
17610
|
-
await taskStore.updateTaskStatus(taskId, status, statusMessage,
|
|
17611
|
-
const updatedTask = await taskStore.getTask(taskId,
|
|
17610
|
+
await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId2);
|
|
17611
|
+
const updatedTask = await taskStore.getTask(taskId, sessionId2);
|
|
17612
17612
|
if (updatedTask) {
|
|
17613
17613
|
const notification = TaskStatusNotificationSchema.parse({
|
|
17614
17614
|
method: "notifications/tasks/status",
|
|
@@ -17621,7 +17621,7 @@ var Protocol = class {
|
|
|
17621
17621
|
}
|
|
17622
17622
|
},
|
|
17623
17623
|
listTasks: (cursor) => {
|
|
17624
|
-
return taskStore.listTasks(cursor,
|
|
17624
|
+
return taskStore.listTasks(cursor, sessionId2);
|
|
17625
17625
|
}
|
|
17626
17626
|
};
|
|
17627
17627
|
}
|
|
@@ -17972,8 +17972,8 @@ var Server = class extends Protocol {
|
|
|
17972
17972
|
this._serverInfo = _serverInfo;
|
|
17973
17973
|
this._loggingLevels = /* @__PURE__ */ new Map();
|
|
17974
17974
|
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
17975
|
-
this.isMessageIgnored = (level,
|
|
17976
|
-
const currentLevel = this._loggingLevels.get(
|
|
17975
|
+
this.isMessageIgnored = (level, sessionId2) => {
|
|
17976
|
+
const currentLevel = this._loggingLevels.get(sessionId2);
|
|
17977
17977
|
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
17978
17978
|
};
|
|
17979
17979
|
this._capabilities = options?.capabilities ?? {};
|
|
@@ -18307,9 +18307,9 @@ var Server = class extends Protocol {
|
|
|
18307
18307
|
* @param params
|
|
18308
18308
|
* @param sessionId optional for stateless and backward compatibility
|
|
18309
18309
|
*/
|
|
18310
|
-
async sendLoggingMessage(params,
|
|
18310
|
+
async sendLoggingMessage(params, sessionId2) {
|
|
18311
18311
|
if (this._capabilities.logging) {
|
|
18312
|
-
if (!this.isMessageIgnored(params.level,
|
|
18312
|
+
if (!this.isMessageIgnored(params.level, sessionId2)) {
|
|
18313
18313
|
return this.notification({ method: "notifications/message", params });
|
|
18314
18314
|
}
|
|
18315
18315
|
}
|
|
@@ -20580,9 +20580,9 @@ var StreamableHTTPClientTransport = class {
|
|
|
20580
20580
|
signal: this._abortController?.signal
|
|
20581
20581
|
};
|
|
20582
20582
|
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
20583
|
-
const
|
|
20584
|
-
if (
|
|
20585
|
-
this._sessionId =
|
|
20583
|
+
const sessionId2 = response.headers.get("mcp-session-id");
|
|
20584
|
+
if (sessionId2) {
|
|
20585
|
+
this._sessionId = sessionId2;
|
|
20586
20586
|
}
|
|
20587
20587
|
if (!response.ok) {
|
|
20588
20588
|
const text = await response.text().catch(() => null);
|
|
@@ -21447,7 +21447,7 @@ async function createClaudeHostSession({ configFile: configFile2, env = process.
|
|
|
21447
21447
|
async function hook(input) {
|
|
21448
21448
|
const event = input?.hook_event_name;
|
|
21449
21449
|
if (!["SessionStart", "PreToolUse", "SessionEnd"].includes(event)) throw error2("host_identity_invalid");
|
|
21450
|
-
const valid = typeof input.session_id === "string" && uuid2.test(input.session_id),
|
|
21450
|
+
const valid = typeof input.session_id === "string" && uuid2.test(input.session_id), sessionId2 = valid ? input.session_id.toLowerCase() : null;
|
|
21451
21451
|
const rawArgs = input.tool_input;
|
|
21452
21452
|
if (event === "PreToolUse" && (!rawArgs || typeof rawArgs !== "object" || Array.isArray(rawArgs) || typeof input.tool_name !== "string" || !/^mcp__[A-Za-z0-9_.:-]+__[A-Za-z0-9_.:-]+$/.test(input.tool_name))) throw error2("host_identity_invalid");
|
|
21453
21453
|
if (!owner) return event === "PreToolUse" && Object.hasOwn(rawArgs, CLAUDE_HOST_PROOF) ? { hookSpecificOutput: { hookEventName: event, updatedInput: withoutProof(rawArgs) } } : {};
|
|
@@ -21455,12 +21455,12 @@ async function createClaudeHostSession({ configFile: configFile2, env = process.
|
|
|
21455
21455
|
await transaction((current) => {
|
|
21456
21456
|
if (current && later(current.order, owner.eventOrder)) return void 0;
|
|
21457
21457
|
if (event === "SessionEnd") {
|
|
21458
|
-
if (current?.sessionId ===
|
|
21459
|
-
if (!current || current.sessionId !==
|
|
21458
|
+
if (current?.sessionId === sessionId2 && ["prompt_input_exit", "logout", "other", "bypass_permissions_disabled"].includes(input.reason)) return null;
|
|
21459
|
+
if (!current || current.sessionId !== sessionId2) return void 0;
|
|
21460
21460
|
}
|
|
21461
21461
|
if (event === "SessionStart" && !["startup", "resume", "fork", "clear", "compact"].includes(input.source)) throw error2("host_identity_invalid");
|
|
21462
|
-
const inconsistent = event === "PreToolUse" && current?.sessionId !==
|
|
21463
|
-
const nextId = event === "SessionEnd" || inconsistent ? null :
|
|
21462
|
+
const inconsistent = event === "PreToolUse" && current?.sessionId !== sessionId2 || event === "SessionStart" && input.source === "compact" && current?.sessionId !== sessionId2 || event === "SessionStart" && input.source === "startup" && current?.sessionId && current.sessionId !== sessionId2;
|
|
21463
|
+
const nextId = event === "SessionEnd" || inconsistent ? null : sessionId2;
|
|
21464
21464
|
const same2 = current && current.sessionId === nextId;
|
|
21465
21465
|
const next = {
|
|
21466
21466
|
contractVersion: "claude-host-session/v1",
|
|
@@ -21596,8 +21596,8 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
|
|
|
21596
21596
|
});
|
|
21597
21597
|
}
|
|
21598
21598
|
function keyFor(params) {
|
|
21599
|
-
const { projectId, sessionId } = params.arguments ?? {}, thread = params._meta?.threadId;
|
|
21600
|
-
return typeof thread === "string" && [projectId,
|
|
21599
|
+
const { projectId, sessionId: sessionId2 } = params.arguments ?? {}, thread = params._meta?.threadId;
|
|
21600
|
+
return typeof thread === "string" && [projectId, sessionId2].every((v2) => typeof v2 === "string" && v2.length > 0 && v2.length <= 160) ? JSON.stringify([thread.toLowerCase(), projectId, sessionId2]) : null;
|
|
21601
21601
|
}
|
|
21602
21602
|
function metadata(params, result) {
|
|
21603
21603
|
const v2 = result?._meta?.["promptframe.creation"];
|
|
@@ -21730,9 +21730,9 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
|
|
|
21730
21730
|
let params = hostParameters(raw, binding.host, "independent-read");
|
|
21731
21731
|
let effectiveAccess = access2, resolvedControl;
|
|
21732
21732
|
if (definition._meta["promptframe.resolveAccess"] === "target") {
|
|
21733
|
-
const { projectId, sessionId, tool, arguments: input } = params.arguments ?? {};
|
|
21733
|
+
const { projectId, sessionId: sessionId2, tool, arguments: input } = params.arguments ?? {};
|
|
21734
21734
|
if (typeof tool !== "string" || !input || typeof input !== "object" || Array.isArray(input)) throw new CreationClientError("creation.request_invalid");
|
|
21735
|
-
const observed = await send({ name: role("describe-target"), _meta: params._meta, arguments: { projectId, sessionId, tool, arguments: input } }, binding);
|
|
21735
|
+
const observed = await send({ name: role("describe-target"), _meta: params._meta, arguments: { projectId, sessionId: sessionId2, tool, arguments: input } }, binding);
|
|
21736
21736
|
if (observed.result.isError) return observed.result;
|
|
21737
21737
|
const resolved = observed.trusted?.resolvedAccess;
|
|
21738
21738
|
const defaults = resolved?.scopeDefaults ?? {};
|
|
@@ -21748,9 +21748,9 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
|
|
|
21748
21748
|
const local = definition._meta["promptframe.localFileUpload"];
|
|
21749
21749
|
if (local?.contractVersion === LOCAL_UPLOAD_PROTOCOL) {
|
|
21750
21750
|
if (!localUploads) throw new CreationClientError("creation.upgrade_required");
|
|
21751
|
-
const { projectId, sessionId } = params.arguments ?? {};
|
|
21752
|
-
if (typeof projectId !== "string" || typeof
|
|
21753
|
-
const observed = await send({ name: role("control-read"), _meta: params._meta, arguments: { projectId, sessionId, pageSize: 1 } }, binding);
|
|
21751
|
+
const { projectId, sessionId: sessionId2 } = params.arguments ?? {};
|
|
21752
|
+
if (typeof projectId !== "string" || typeof sessionId2 !== "string") throw new CreationClientError("creation.request_invalid");
|
|
21753
|
+
const observed = await send({ name: role("control-read"), _meta: params._meta, arguments: { projectId, sessionId: sessionId2, pageSize: 1 } }, binding);
|
|
21754
21754
|
if (observed.result.isError) return observed.result;
|
|
21755
21755
|
if (!observed.trusted) throw new CreationClientError("creation.access_unverified");
|
|
21756
21756
|
const value2 = await localUploads.call({
|
|
@@ -21764,9 +21764,9 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
|
|
|
21764
21764
|
host: binding.host.kind,
|
|
21765
21765
|
thread: params._meta.threadId.toLowerCase(),
|
|
21766
21766
|
projectId,
|
|
21767
|
-
sessionId
|
|
21767
|
+
sessionId: sessionId2
|
|
21768
21768
|
},
|
|
21769
|
-
send: (transfer, options) => send({ name: params.name, _meta: params._meta, arguments: { projectId, sessionId, transfer } }, binding, { timeout: 3e4, ...options })
|
|
21769
|
+
send: (transfer, options) => send({ name: params.name, _meta: params._meta, arguments: { projectId, sessionId: sessionId2, transfer } }, binding, { timeout: 3e4, ...options })
|
|
21770
21770
|
});
|
|
21771
21771
|
return assertMcpResponseBudget({ content: [{ type: "text", text: JSON.stringify(value2) }] });
|
|
21772
21772
|
}
|
|
@@ -21869,8 +21869,8 @@ function createAccountAwareBridge(defaultClient, {
|
|
|
21869
21869
|
function caller(raw, binding, required2 = false) {
|
|
21870
21870
|
const params = { ...raw, arguments: binding.arguments };
|
|
21871
21871
|
hostParameters(params, binding.host, required2 ? "authority" : "independent-read");
|
|
21872
|
-
const
|
|
21873
|
-
return
|
|
21872
|
+
const sessionId2 = isHookProofHost(binding.host.kind) ? binding.host.threadId : params._meta?.threadId;
|
|
21873
|
+
return sessionId2 ? { kind: binding.host.kind, sessionId: sessionId2 } : void 0;
|
|
21874
21874
|
}
|
|
21875
21875
|
async function context(identity, agent, referenceId) {
|
|
21876
21876
|
if (sameIdentity(identity, primaryIdentity) && (!referenceId || referenceId === localReferenceId("creation", path10.resolve(configFile2)))) return primary;
|
|
@@ -21983,7 +21983,11 @@ import { homedir as homedir5 } from "node:os";
|
|
|
21983
21983
|
import { createHash as createHash7, randomBytes as randomBytes4 } from "node:crypto";
|
|
21984
21984
|
var hex2 = /^[0-9a-f]{64}$/;
|
|
21985
21985
|
var TICKET_TTL_MS = 12e4;
|
|
21986
|
+
var SESSION_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
21986
21987
|
var MAX_TICKETS = 256;
|
|
21988
|
+
var MAX_SESSIONS = 256;
|
|
21989
|
+
var DEFAULT_SERVER = "promptframe_pf";
|
|
21990
|
+
var mcpToolName = /^[A-Za-z0-9_.:-]{1,200}$/;
|
|
21987
21991
|
var error4 = (code) => new CreationClientError("creation." + code);
|
|
21988
21992
|
var canonical3 = (value2) => {
|
|
21989
21993
|
if (value2 === null || typeof value2 === "string" || typeof value2 === "boolean" || typeof value2 === "number" && Number.isFinite(value2)) return JSON.stringify(value2);
|
|
@@ -21994,9 +21998,31 @@ var canonical3 = (value2) => {
|
|
|
21994
21998
|
};
|
|
21995
21999
|
var digest4 = (value2) => createHash7("sha256").update(canonical3(value2)).digest("hex");
|
|
21996
22000
|
var withoutProof2 = (args2) => Object.fromEntries(Object.entries(args2 ?? {}).filter(([key]) => key !== CLAUDE_HOST_PROOF));
|
|
21997
|
-
function
|
|
21998
|
-
|
|
21999
|
-
|
|
22001
|
+
function objectArgs(value2) {
|
|
22002
|
+
return value2 && typeof value2 === "object" && !Array.isArray(value2) ? value2 : null;
|
|
22003
|
+
}
|
|
22004
|
+
function promptFrameCall(toolCall, serverName) {
|
|
22005
|
+
if (typeof toolCall?.name !== "string") return null;
|
|
22006
|
+
const args2 = objectArgs(toolCall.args) ?? {};
|
|
22007
|
+
if (toolCall.name === "call_mcp_tool") {
|
|
22008
|
+
if (args2.ServerName !== serverName || typeof args2.ToolName !== "string" || !mcpToolName.test(args2.ToolName)) return null;
|
|
22009
|
+
const inner = args2.Arguments === void 0 ? {} : objectArgs(args2.Arguments);
|
|
22010
|
+
return inner ? { name: args2.ToolName, args: inner, lazy: true } : null;
|
|
22011
|
+
}
|
|
22012
|
+
const namespacedPrefix = `mcp_${serverName}_`, oldPrefix = `mcp_${serverName.split("_")[0]}_`;
|
|
22013
|
+
if (toolCall.name.startsWith(namespacedPrefix)) {
|
|
22014
|
+
const name2 = toolCall.name.slice(namespacedPrefix.length);
|
|
22015
|
+
return mcpToolName.test(name2) ? { name: name2, args: args2, lazy: false } : null;
|
|
22016
|
+
}
|
|
22017
|
+
const name = toolCall.name.startsWith(oldPrefix) ? toolCall.name.slice(oldPrefix.length) : toolCall.name;
|
|
22018
|
+
return /^(?:platform_|promptframe_local_)[a-z0-9_]+$/i.test(name) && mcpToolName.test(name) ? { name, args: args2, lazy: false } : null;
|
|
22019
|
+
}
|
|
22020
|
+
function sessionId(value2) {
|
|
22021
|
+
return typeof value2 === "string" && threadFormat.test(value2) ? value2.toLowerCase() : null;
|
|
22022
|
+
}
|
|
22023
|
+
function transcriptDigest(input) {
|
|
22024
|
+
const file = input?.transcriptPath;
|
|
22025
|
+
return typeof file === "string" && file.length <= 4096 && path11.isAbsolute(file) ? digest4(path11.normalize(file)) : null;
|
|
22000
22026
|
}
|
|
22001
22027
|
function toolNameMatches(hookToolName, bridgeToolName) {
|
|
22002
22028
|
if (typeof hookToolName !== "string" || typeof bridgeToolName !== "string" || !bridgeToolName) return false;
|
|
@@ -22029,7 +22055,7 @@ async function privateRead2(file) {
|
|
|
22029
22055
|
function antigravityConfigRoot(env = process.env) {
|
|
22030
22056
|
return path11.resolve(env.ANTIGRAVITY_CONFIG_DIR ?? env.GEMINI_CONFIG_DIR ?? path11.join(homedir5(), ".gemini", "config"));
|
|
22031
22057
|
}
|
|
22032
|
-
async function createAntigravityHostSession({ configFile: configFile2, env = process.env, root, now = () => Date.now() } = {}) {
|
|
22058
|
+
async function createAntigravityHostSession({ configFile: configFile2, env = process.env, root, serverName = DEFAULT_SERVER, now = () => Date.now() } = {}) {
|
|
22033
22059
|
const base = root ?? path11.join(antigravityConfigRoot(env), "promptframe-host-sessions");
|
|
22034
22060
|
const namespace = path11.join(base, digest4(path11.resolve(configFile2)));
|
|
22035
22061
|
const stateFile = path11.join(namespace, "state.json");
|
|
@@ -22092,6 +22118,16 @@ async function createAntigravityHostSession({ configFile: configFile2, env = pro
|
|
|
22092
22118
|
while (keys.length >= MAX_TICKETS) delete kept[keys.shift()];
|
|
22093
22119
|
return kept;
|
|
22094
22120
|
}
|
|
22121
|
+
function pruneSessions(sessions, currentTime) {
|
|
22122
|
+
const active = Object.entries(sessions ?? {}).filter(([id, value2]) => sessionId(id) && Number.isSafeInteger(value2?.expiresAt) && value2.expiresAt > currentTime);
|
|
22123
|
+
return Object.fromEntries(active.slice(-MAX_SESSIONS));
|
|
22124
|
+
}
|
|
22125
|
+
function bindSession(sessions, id, transcript, currentTime) {
|
|
22126
|
+
const previous = sessions[id];
|
|
22127
|
+
delete sessions[id];
|
|
22128
|
+
sessions[id] = { transcriptDigest: transcript ?? previous?.transcriptDigest ?? null, expiresAt: currentTime + SESSION_TTL_MS };
|
|
22129
|
+
return pruneSessions(sessions, currentTime);
|
|
22130
|
+
}
|
|
22095
22131
|
async function begin(raw) {
|
|
22096
22132
|
const proof = raw.arguments?.[CLAUDE_HOST_PROOF], args2 = withoutProof2(raw.arguments);
|
|
22097
22133
|
if (proof === void 0) return { host: { kind: "antigravity" }, assertCurrent: async () => {
|
|
@@ -22102,7 +22138,7 @@ async function createAntigravityHostSession({ configFile: configFile2, env = pro
|
|
|
22102
22138
|
try {
|
|
22103
22139
|
await transaction((current) => {
|
|
22104
22140
|
const ticket = current.tickets[proof];
|
|
22105
|
-
if (!ticket || ticket.expiresAt <= currentTime || ticket.argsDigest !== argsHash || !toolNameMatches(ticket.toolName, raw.name) || !threadFormat.test(ticket.conversationId ?? ""))
|
|
22141
|
+
if (!ticket || ticket.expiresAt <= currentTime || ticket.argsDigest !== argsHash || !(ticket.exactToolName ? ticket.toolName === raw.name : toolNameMatches(ticket.toolName, raw.name)) || !threadFormat.test(ticket.conversationId ?? ""))
|
|
22106
22142
|
throw error4("host_identity_invalid");
|
|
22107
22143
|
accepted = { threadId: ticket.conversationId.toLowerCase() };
|
|
22108
22144
|
delete current.tickets[proof];
|
|
@@ -22116,26 +22152,33 @@ async function createAntigravityHostSession({ configFile: configFile2, env = pro
|
|
|
22116
22152
|
return { host: { kind: "antigravity", threadId: accepted.threadId }, arguments: args2, assertCurrent: async () => {
|
|
22117
22153
|
} };
|
|
22118
22154
|
}
|
|
22119
|
-
async function hook(input) {
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
}
|
|
22130
|
-
const
|
|
22155
|
+
async function hook(input, event = input?.hookEventName ?? "PreToolUse") {
|
|
22156
|
+
if (input?.hookEventName !== void 0 && input.hookEventName !== event) return {};
|
|
22157
|
+
const id = sessionId(input?.conversationId), transcript = transcriptDigest(input), currentTime = now();
|
|
22158
|
+
if (event === "SessionStart") {
|
|
22159
|
+
if (id) await transaction((current) => {
|
|
22160
|
+
current.sessions = bindSession(pruneSessions(current.sessions, currentTime), id, transcript, currentTime);
|
|
22161
|
+
return current;
|
|
22162
|
+
});
|
|
22163
|
+
return {};
|
|
22164
|
+
}
|
|
22165
|
+
if (event !== "PreToolUse") return {};
|
|
22166
|
+
const call = promptFrameCall(input?.toolCall, serverName);
|
|
22167
|
+
if (!call) return { decision: "allow" };
|
|
22168
|
+
const args2 = withoutProof2(call.args), argsHash = digest4(args2);
|
|
22131
22169
|
let token;
|
|
22132
22170
|
await transaction((current) => {
|
|
22171
|
+
const sessions = pruneSessions(current.sessions, currentTime);
|
|
22172
|
+
const matches = !id && input?.conversationId === void 0 && transcript ? Object.keys(sessions).filter((key) => sessions[key].transcriptDigest === transcript) : [];
|
|
22173
|
+
const conversationId = id ?? (matches.length === 1 ? matches[0] : null);
|
|
22174
|
+
if (!conversationId) return;
|
|
22133
22175
|
const tickets = pruneTickets(current.tickets, currentTime);
|
|
22134
22176
|
token = randomBytes4(32).toString("hex");
|
|
22135
|
-
tickets[token] = { toolName:
|
|
22136
|
-
return { contractVersion: "antigravity-host-session/v1", tickets };
|
|
22177
|
+
tickets[token] = { toolName: call.name, exactToolName: true, argsDigest: argsHash, conversationId, expiresAt: currentTime + TICKET_TTL_MS };
|
|
22178
|
+
return { contractVersion: "antigravity-host-session/v1", tickets, sessions: bindSession(sessions, conversationId, transcript, currentTime) };
|
|
22137
22179
|
});
|
|
22138
|
-
return { decision: "
|
|
22180
|
+
if (!token) return Object.hasOwn(call.args, CLAUDE_HOST_PROOF) ? { decision: "deny", reason: "Missing valid Antigravity conversationId for PromptFrame proof." } : { decision: "allow" };
|
|
22181
|
+
return { decision: "allow", overwrite: call.lazy ? { Arguments: { ...args2, [CLAUDE_HOST_PROOF]: token } } : { [CLAUDE_HOST_PROOF]: token } };
|
|
22139
22182
|
}
|
|
22140
22183
|
return { begin, hook };
|
|
22141
22184
|
}
|
|
@@ -22150,10 +22193,10 @@ async function readAntigravityHookInput(input) {
|
|
|
22150
22193
|
}
|
|
22151
22194
|
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes2)));
|
|
22152
22195
|
}
|
|
22153
|
-
async function runAntigravityHostHook({ configFile: configFile2, input = process.stdin, output = process.stdout, env = process.env } = {}) {
|
|
22196
|
+
async function runAntigravityHostHook({ configFile: configFile2, serverName, event, input = process.stdin, output = process.stdout, env = process.env } = {}) {
|
|
22154
22197
|
const body = await readAntigravityHookInput(input);
|
|
22155
|
-
const store = await createAntigravityHostSession({ configFile: configFile2, env });
|
|
22156
|
-
output.write(JSON.stringify(await store.hook(body)) + "\n");
|
|
22198
|
+
const store = await createAntigravityHostSession({ configFile: configFile2, serverName, env });
|
|
22199
|
+
output.write(JSON.stringify(await store.hook(body, event)) + "\n");
|
|
22157
22200
|
}
|
|
22158
22201
|
|
|
22159
22202
|
// lib/runtime-bootstrap.mjs
|
|
@@ -27540,18 +27583,81 @@ async function installClaudeUserLocked({
|
|
|
27540
27583
|
|
|
27541
27584
|
// lib/antigravity-installation.mjs
|
|
27542
27585
|
import { lstat as lstat13, mkdir as mkdir10, open as open13, readFile as readFile10, rename as rename10, rm as rm6 } from "node:fs/promises";
|
|
27586
|
+
import { constants as constants9 } from "node:fs";
|
|
27543
27587
|
import { createHash as createHash14, randomBytes as randomBytes9 } from "node:crypto";
|
|
27544
27588
|
import { homedir as homedir12 } from "node:os";
|
|
27545
27589
|
import path21 from "node:path";
|
|
27546
27590
|
var hash7 = (b2) => createHash14("sha256").update(b2).digest("hex");
|
|
27547
|
-
var
|
|
27548
|
-
|
|
27591
|
+
var AntigravityInstallationError = class extends CreationClientError {
|
|
27592
|
+
constructor(code, details) {
|
|
27593
|
+
super("installation." + code);
|
|
27594
|
+
this.details = details;
|
|
27595
|
+
}
|
|
27596
|
+
};
|
|
27597
|
+
var antigravityInstallationDetails = (error6) => error6 instanceof AntigravityInstallationError ? error6.details : void 0;
|
|
27598
|
+
var fail8 = (code, details) => {
|
|
27599
|
+
throw new AntigravityInstallationError(code, details);
|
|
27549
27600
|
};
|
|
27550
27601
|
var profileFormat = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
27602
|
+
var ANTIGRAVITY_MCP_SERVER_KEY = "pf";
|
|
27603
|
+
var antigravityPluginName = (profile) => "promptframe" + (profile === "default" ? "" : "-" + profile);
|
|
27604
|
+
var legacyAntigravityPluginName = (profile) => "promptframe-creation" + (profile === "default" ? "" : "-" + profile);
|
|
27605
|
+
var antigravityServerName = (profile) => `${antigravityPluginName(profile)}_${ANTIGRAVITY_MCP_SERVER_KEY}`;
|
|
27606
|
+
var object3 = (value2) => value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
27607
|
+
function usesCreationBridge(server, { profile, configFile: configFile2 }) {
|
|
27608
|
+
if (!object3(server) || typeof server.command !== "string" || !Array.isArray(server.args)) return false;
|
|
27609
|
+
const args2 = server.args;
|
|
27610
|
+
const bridgeIndex = args2.indexOf("bridge");
|
|
27611
|
+
if (bridgeIndex < 0) return false;
|
|
27612
|
+
const isCreationExecutable = (value2) => typeof value2 === "string" && /^promptframe-creation(?:\.mjs|\.cmd|\.exe)?$/.test(path21.win32.basename(value2));
|
|
27613
|
+
const command2 = path21.win32.basename(server.command);
|
|
27614
|
+
const bridgeLauncher = isCreationExecutable(command2) || /^(?:node|nodejs|bun)(?:\.exe)?$/.test(command2) && isCreationExecutable(args2[bridgeIndex - 1]) || /^(?:npx|npm|pnpm|yarn|bunx)(?:\.cmd|\.exe)?$/.test(command2) && typeof args2[bridgeIndex - 1] === "string" && /^@promptframe\/creation(?:@[^\s]+)?$/.test(args2[bridgeIndex - 1]);
|
|
27615
|
+
if (!bridgeLauncher) return false;
|
|
27616
|
+
const configIndex = args2.indexOf("--config", bridgeIndex + 1);
|
|
27617
|
+
const profileIndex = args2.indexOf("--profile", bridgeIndex + 1);
|
|
27618
|
+
const configuredProfile = profileIndex < 0 ? "default" : args2[profileIndex + 1];
|
|
27619
|
+
const configuredFile = configIndex >= 0 ? args2[configIndex + 1] : configuredProfile === "default" ? server.env?.PROMPTFRAME_CREATION_CONFIG : void 0;
|
|
27620
|
+
if (typeof configuredFile === "string" && path21.isAbsolute(configuredFile)) return path21.resolve(configuredFile) === configFile2;
|
|
27621
|
+
return configuredProfile === profile;
|
|
27622
|
+
}
|
|
27623
|
+
async function checkAntigravityMcpConflicts({ profile = "default", configFile: configFile2, env = process.env } = {}) {
|
|
27624
|
+
const mcpConfigFile = path21.join(antigravityConfigRoot(env), "mcp_config.json");
|
|
27625
|
+
const unreadable = () => fail8("antigravity_mcp_config_unreadable", {
|
|
27626
|
+
mcpConfigFile,
|
|
27627
|
+
action: "Check that the Antigravity MCP configuration is readable and contains a valid JSON object, then retry connect."
|
|
27628
|
+
});
|
|
27629
|
+
let file;
|
|
27630
|
+
try {
|
|
27631
|
+
file = await open13(mcpConfigFile, constants9.O_RDONLY | constants9.O_NONBLOCK);
|
|
27632
|
+
} catch (error6) {
|
|
27633
|
+
if (error6.code === "ENOENT") return;
|
|
27634
|
+
unreadable();
|
|
27635
|
+
}
|
|
27636
|
+
let config2;
|
|
27637
|
+
try {
|
|
27638
|
+
const info5 = await file.stat();
|
|
27639
|
+
if (!info5.isFile() || info5.size > 4 * 1024 * 1024) unreadable();
|
|
27640
|
+
config2 = JSON.parse(await file.readFile("utf8"));
|
|
27641
|
+
} catch {
|
|
27642
|
+
unreadable();
|
|
27643
|
+
} finally {
|
|
27644
|
+
await file.close();
|
|
27645
|
+
}
|
|
27646
|
+
if (!object3(config2) || config2.mcpServers !== void 0 && !object3(config2.mcpServers)) unreadable();
|
|
27647
|
+
const pluginName = antigravityPluginName(profile);
|
|
27648
|
+
const legacyPluginName = legacyAntigravityPluginName(profile);
|
|
27649
|
+
const serverName = antigravityServerName(profile);
|
|
27650
|
+
const mcpServerNames = Object.entries(config2.mcpServers ?? {}).filter(([name, server]) => name === pluginName || name === serverName || name === legacyPluginName || name === `${legacyPluginName}_${legacyPluginName}` || usesCreationBridge(server, { profile, configFile: configFile2 })).map(([name]) => name);
|
|
27651
|
+
if (mcpServerNames.length) fail8("legacy_mcp_entry_requires_review", {
|
|
27652
|
+
mcpConfigFile,
|
|
27653
|
+
mcpServerNames,
|
|
27654
|
+
action: "In Antigravity MCP settings, review the listed entries and remove the conflicting manual PromptFrame entries, then rerun connect with the existing Token."
|
|
27655
|
+
});
|
|
27656
|
+
}
|
|
27551
27657
|
function shellQuote(value2) {
|
|
27552
27658
|
return '"' + String(value2).replace(/(["\\$`])/g, "\\$1") + '"';
|
|
27553
27659
|
}
|
|
27554
|
-
function antigravityPluginManifest({ version: version3, name = "promptframe
|
|
27660
|
+
function antigravityPluginManifest({ version: version3, name = "promptframe", displayName = "PromptFrame Creation" }) {
|
|
27555
27661
|
return {
|
|
27556
27662
|
name,
|
|
27557
27663
|
displayName,
|
|
@@ -27565,25 +27671,34 @@ function antigravityPluginManifest({ version: version3, name = "promptframe-crea
|
|
|
27565
27671
|
]
|
|
27566
27672
|
};
|
|
27567
27673
|
}
|
|
27568
|
-
function antigravityMcpConfig({
|
|
27674
|
+
function antigravityMcpConfig({ serverKey = ANTIGRAVITY_MCP_SERVER_KEY, nodeCommand, runtimeRoot, configFile: configFile2 }) {
|
|
27569
27675
|
return {
|
|
27570
27676
|
mcpServers: {
|
|
27571
|
-
[
|
|
27677
|
+
[serverKey]: {
|
|
27572
27678
|
command: nodeCommand,
|
|
27573
27679
|
args: [path21.join(runtimeRoot, "bin", "promptframe-creation.mjs"), "bridge", "--config", configFile2, "--host", "antigravity"]
|
|
27574
27680
|
}
|
|
27575
27681
|
}
|
|
27576
27682
|
};
|
|
27577
27683
|
}
|
|
27578
|
-
function antigravityHooksConfig({ nodeCommand, runtimeRoot, configFile: configFile2 }) {
|
|
27684
|
+
function antigravityHooksConfig({ nodeCommand, runtimeRoot, configFile: configFile2, serverName }) {
|
|
27579
27685
|
const cliPath = path21.join(runtimeRoot, "bin", "promptframe-creation.mjs");
|
|
27580
|
-
const command2 = [
|
|
27686
|
+
const command2 = [
|
|
27687
|
+
shellQuote(nodeCommand),
|
|
27688
|
+
shellQuote(cliPath),
|
|
27689
|
+
"antigravity-host-hook",
|
|
27690
|
+
"--config",
|
|
27691
|
+
shellQuote(configFile2),
|
|
27692
|
+
"--mcp-server",
|
|
27693
|
+
shellQuote(serverName)
|
|
27694
|
+
].join(" ");
|
|
27581
27695
|
return {
|
|
27582
27696
|
"promptframe-host-identity": {
|
|
27697
|
+
SessionStart: [{ type: "command", command: command2 + " --hook-event SessionStart", timeout: 5 }],
|
|
27583
27698
|
PreToolUse: [
|
|
27584
27699
|
{
|
|
27585
|
-
matcher: "(.*promptframe.*|^platform_
|
|
27586
|
-
hooks: [{ type: "command", command: command2, timeout: 5 }]
|
|
27700
|
+
matcher: "(.*promptframe.*|^platform_.*|^call_mcp_tool$)",
|
|
27701
|
+
hooks: [{ type: "command", command: command2 + " --hook-event PreToolUse", timeout: 5 }]
|
|
27587
27702
|
}
|
|
27588
27703
|
]
|
|
27589
27704
|
}
|
|
@@ -27631,6 +27746,21 @@ async function copyPackagePayload(payload, destRoot) {
|
|
|
27631
27746
|
throw e;
|
|
27632
27747
|
}
|
|
27633
27748
|
}
|
|
27749
|
+
async function cleanupLegacyPluginDirectory({ pluginsRoot, profile, configFile: configFile2 }) {
|
|
27750
|
+
const legacyDir = path21.join(pluginsRoot, legacyAntigravityPluginName(profile));
|
|
27751
|
+
let status;
|
|
27752
|
+
try {
|
|
27753
|
+
status = await lstat13(legacyDir);
|
|
27754
|
+
} catch (e) {
|
|
27755
|
+
if (e.code === "ENOENT") return false;
|
|
27756
|
+
throw e;
|
|
27757
|
+
}
|
|
27758
|
+
if (!status.isDirectory() || status.isSymbolicLink()) return false;
|
|
27759
|
+
const legacyMarker = await readJsonOrNull(path21.join(legacyDir, "promptframe-installation.json"));
|
|
27760
|
+
if (!legacyMarker || legacyMarker.host !== "antigravity" || legacyMarker.profile !== profile || legacyMarker.configFile !== configFile2) return false;
|
|
27761
|
+
await rm6(legacyDir, { recursive: true, force: true });
|
|
27762
|
+
return true;
|
|
27763
|
+
}
|
|
27634
27764
|
async function installForAntigravityUser({
|
|
27635
27765
|
sourceRoot,
|
|
27636
27766
|
profile = "default",
|
|
@@ -27642,10 +27772,11 @@ async function installForAntigravityUser({
|
|
|
27642
27772
|
if (!profileFormat.test(profile)) fail8("profile_invalid");
|
|
27643
27773
|
if (!path21.isAbsolute(configFile2 ?? "")) fail8("config_path_invalid");
|
|
27644
27774
|
signal?.throwIfAborted();
|
|
27775
|
+
await checkAntigravityMcpConflicts({ profile, configFile: configFile2, env });
|
|
27645
27776
|
const payload = await inspectRuntimePackage(sourceRoot);
|
|
27646
|
-
const
|
|
27647
|
-
const
|
|
27648
|
-
const serverName =
|
|
27777
|
+
const pluginDirName = antigravityPluginName(profile);
|
|
27778
|
+
const serverKey = ANTIGRAVITY_MCP_SERVER_KEY;
|
|
27779
|
+
const serverName = antigravityServerName(profile);
|
|
27649
27780
|
const dataRoot = path21.resolve(env.XDG_DATA_HOME ?? path21.join(homedir12(), ".local", "share"), "promptframe-creation", profile, "antigravity");
|
|
27650
27781
|
const versionRoot = path21.join(dataRoot, "versions", payload.version);
|
|
27651
27782
|
const pluginsRoot = path21.join(antigravityConfigRoot(env), "plugins");
|
|
@@ -27665,6 +27796,7 @@ async function installForAntigravityUser({
|
|
|
27665
27796
|
if (existing.host !== "antigravity" || existing.profile !== profile || existing.configFile !== configFile2 || typeof existing.version !== "string" || !/^\d+\.\d+\.\d+$/.test(existing.version)) fail8("managed_installation_invalid");
|
|
27666
27797
|
const cmp = compareBridgeVersions(existing.version, payload.version);
|
|
27667
27798
|
if (cmp > 0) {
|
|
27799
|
+
await cleanupLegacyPluginDirectory({ pluginsRoot, profile, configFile: configFile2 });
|
|
27668
27800
|
return {
|
|
27669
27801
|
registered: true,
|
|
27670
27802
|
pluginInstalled: true,
|
|
@@ -27683,7 +27815,8 @@ async function installForAntigravityUser({
|
|
|
27683
27815
|
skills: [{ name: "creation-setup" }, { name: "video-creation" }]
|
|
27684
27816
|
};
|
|
27685
27817
|
}
|
|
27686
|
-
if (cmp === 0 && existing.payloadDigest === payload.payloadDigest && existing.versionRoot === versionRoot) {
|
|
27818
|
+
if (cmp === 0 && existing.payloadDigest === payload.payloadDigest && existing.versionRoot === versionRoot && existing.serverName === serverName) {
|
|
27819
|
+
await cleanupLegacyPluginDirectory({ pluginsRoot, profile, configFile: configFile2 });
|
|
27687
27820
|
return {
|
|
27688
27821
|
registered: true,
|
|
27689
27822
|
pluginInstalled: true,
|
|
@@ -27724,8 +27857,8 @@ async function installForAntigravityUser({
|
|
|
27724
27857
|
name: pluginDirName,
|
|
27725
27858
|
displayName: profile === "default" ? "PromptFrame Creation" : "PromptFrame Creation (" + profile + ")"
|
|
27726
27859
|
}), null, 2) + "\n";
|
|
27727
|
-
const mcpJson = JSON.stringify(antigravityMcpConfig({
|
|
27728
|
-
const hooksJson = JSON.stringify(antigravityHooksConfig({ nodeCommand, runtimeRoot: versionRoot, configFile: configFile2 }), null, 2) + "\n";
|
|
27860
|
+
const mcpJson = JSON.stringify(antigravityMcpConfig({ serverKey, nodeCommand, runtimeRoot: versionRoot, configFile: configFile2 }), null, 2) + "\n";
|
|
27861
|
+
const hooksJson = JSON.stringify(antigravityHooksConfig({ nodeCommand, runtimeRoot: versionRoot, configFile: configFile2, serverName }), null, 2) + "\n";
|
|
27729
27862
|
await writeFileAtomic(path21.join(pluginDir, "plugin.json"), pluginJson, 420);
|
|
27730
27863
|
await writeFileAtomic(path21.join(pluginDir, "mcp_config.json"), mcpJson, 384);
|
|
27731
27864
|
await writeFileAtomic(path21.join(pluginDir, "hooks.json"), hooksJson, 384);
|
|
@@ -27740,6 +27873,7 @@ async function installForAntigravityUser({
|
|
|
27740
27873
|
profile,
|
|
27741
27874
|
configFile: configFile2,
|
|
27742
27875
|
pluginDirName,
|
|
27876
|
+
serverKey,
|
|
27743
27877
|
serverName,
|
|
27744
27878
|
version: payload.version,
|
|
27745
27879
|
versionRoot,
|
|
@@ -27750,6 +27884,7 @@ async function installForAntigravityUser({
|
|
|
27750
27884
|
installedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
27751
27885
|
};
|
|
27752
27886
|
await writeFileAtomic(markerFile, JSON.stringify(record2, null, 2) + "\n", 384);
|
|
27887
|
+
await cleanupLegacyPluginDirectory({ pluginsRoot, profile, configFile: configFile2 });
|
|
27753
27888
|
return {
|
|
27754
27889
|
registered: true,
|
|
27755
27890
|
pluginInstalled: true,
|
|
@@ -28061,18 +28196,20 @@ async function bridge() {
|
|
|
28061
28196
|
try {
|
|
28062
28197
|
if (command === "setup") await setup();
|
|
28063
28198
|
else if (command === "connect" || command === "install") {
|
|
28199
|
+
const host = resolveHostIdentity({ host: value("--host") });
|
|
28200
|
+
const profile = value("--profile") ?? "default";
|
|
28201
|
+
if (host.kind === "antigravity") await checkAntigravityMcpConflicts({ profile, configFile: configFile() });
|
|
28064
28202
|
const connection = await setup({ silent: true });
|
|
28065
28203
|
const signal = new AbortController();
|
|
28066
28204
|
const abort = () => signal.abort();
|
|
28067
28205
|
process.once("SIGINT", abort);
|
|
28068
28206
|
process.once("SIGTERM", abort);
|
|
28069
28207
|
try {
|
|
28070
|
-
const host = resolveHostIdentity({ host: value("--host") });
|
|
28071
28208
|
const installer = host.kind === "claude-code" ? installForClaudeUser : host.kind === "antigravity" ? installForAntigravityUser : installForUser;
|
|
28072
28209
|
const installed = await installer({
|
|
28073
28210
|
sourceRoot: fileURLToPath(new URL("..", import.meta.url)),
|
|
28074
28211
|
executable: value("--claude-bin"),
|
|
28075
|
-
profile
|
|
28212
|
+
profile,
|
|
28076
28213
|
configFile: configFile(),
|
|
28077
28214
|
signal: signal.signal
|
|
28078
28215
|
});
|
|
@@ -28104,7 +28241,11 @@ try {
|
|
|
28104
28241
|
}
|
|
28105
28242
|
} else if (command === "bridge") await bridge();
|
|
28106
28243
|
else if (command === "claude-host-hook") await runClaudeHostHook({ configFile: configFile() });
|
|
28107
|
-
else if (command === "antigravity-host-hook") await runAntigravityHostHook({
|
|
28244
|
+
else if (command === "antigravity-host-hook") await runAntigravityHostHook({
|
|
28245
|
+
configFile: configFile(),
|
|
28246
|
+
serverName: value("--mcp-server"),
|
|
28247
|
+
event: value("--hook-event")
|
|
28248
|
+
});
|
|
28108
28249
|
else if (command === "--version") process.stdout.write(CLIENT_VERSION + "\n");
|
|
28109
28250
|
else if (command === "accounts") {
|
|
28110
28251
|
if (args[0] === "refresh") {
|
|
@@ -28135,6 +28276,7 @@ try {
|
|
|
28135
28276
|
process.stderr.write(
|
|
28136
28277
|
JSON.stringify({
|
|
28137
28278
|
...installationErrorDetails(error6),
|
|
28279
|
+
...antigravityInstallationDetails(error6),
|
|
28138
28280
|
...claudeInstallationDetails(error6),
|
|
28139
28281
|
...claudeErrorDetails(error6),
|
|
28140
28282
|
...fallbackErrorDetails(error6),
|