ftown-bridge 0.30.55 → 0.30.57
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/command-rpc.js +18 -1
- package/dist/command-rpc.js.map +1 -1
- package/dist/create-ftown-session.d.ts +1 -1
- package/dist/create-ftown-session.js +2 -0
- package/dist/create-ftown-session.js.map +1 -1
- package/dist/ftown-cli.js +22 -2
- package/dist/ftown-cli.js.map +1 -1
- package/dist/harness-registry.d.ts +8 -2
- package/dist/harness-registry.js +21 -1
- package/dist/harness-registry.js.map +1 -1
- package/dist/hook-usage.js +2 -2
- package/dist/hook-usage.js.map +1 -1
- package/dist/index.js +92 -21
- package/dist/index.js.map +1 -1
- package/dist/installation-manifest.js +2 -2
- package/dist/installation-manifest.js.map +1 -1
- package/dist/local-api-server.d.ts +4 -1
- package/dist/local-api-server.js +31 -1
- package/dist/local-api-server.js.map +1 -1
- package/dist/mail-delivery.js +8 -5
- package/dist/mail-delivery.js.map +1 -1
- package/dist/peer-control.d.ts +2 -1
- package/dist/peer-control.js +3 -0
- package/dist/peer-control.js.map +1 -1
- package/dist/pi-extension-installer.d.ts +2 -2
- package/dist/pi-extension-installer.js +10 -8
- package/dist/pi-extension-installer.js.map +1 -1
- package/dist/preview-chat-protocol.d.ts +1 -1
- package/dist/preview-chat-protocol.js +1 -1
- package/dist/preview-chat-protocol.js.map +1 -1
- package/dist/project-board-store.d.ts +35 -3
- package/dist/project-board-store.js +205 -21
- package/dist/project-board-store.js.map +1 -1
- package/dist/quota/omp.d.ts +3 -0
- package/dist/quota/omp.js +129 -0
- package/dist/quota/omp.js.map +1 -0
- package/dist/quota/routing.js +15 -0
- package/dist/quota/routing.js.map +1 -1
- package/dist/quota/types.d.ts +1 -1
- package/dist/quota/types.js +1 -1
- package/dist/quota/types.js.map +1 -1
- package/dist/quota-cli.js +4 -1
- package/dist/quota-cli.js.map +1 -1
- package/dist/security/bridge/permissions.js +6 -1
- package/dist/security/bridge/permissions.js.map +1 -1
- package/dist/security/bridge/security.js +2 -2
- package/dist/security/bridge/security.js.map +1 -1
- package/dist/session-ids.js +1 -1
- package/dist/session-ids.js.map +1 -1
- package/dist/session-parent.d.ts +1 -1
- package/dist/sessions-commands.js +1 -1
- package/dist/sessions-commands.js.map +1 -1
- package/dist/setup.js +3 -3
- package/dist/setup.js.map +1 -1
- package/dist/ticket-notification-protocol.d.ts +24 -0
- package/dist/ticket-notification-protocol.js +15 -0
- package/dist/ticket-notification-protocol.js.map +1 -0
- package/dist/ticket-notifications.d.ts +21 -0
- package/dist/ticket-notifications.js +93 -0
- package/dist/ticket-notifications.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/usage-collector.js +15 -9
- package/dist/usage-collector.js.map +1 -1
- package/package.json +2 -2
- package/pi-extension/API.md +8 -8
- package/pi-extension/ftown.js +40 -21
- package/pi-extension/omp.js +5 -0
- package/pi-extension/omp.yml +5 -0
- package/skills/ftown/SKILL.md +6 -1
- package/skills/ftown/references/quota.md +2 -2
- package/skills/ftown/references/sessions.md +6 -7
package/dist/local-api-server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TICKET_NOTIFICATION_WIRE, TICKET_NOTIFICATION_INBOX } from './ticket-notification-protocol.js';
|
|
1
2
|
import { PROJECT_DIRECTORY } from './project-directory-protocol.js';
|
|
2
3
|
import { INSTRUCTIONS_LOCAL, INSTRUCTIONS_SYNC, INSTRUCTIONS_WIRE } from './instructions-protocol.js';
|
|
3
4
|
import { mergeGlobal, readRevision } from './instructions.js';
|
|
@@ -155,6 +156,8 @@ export class LocalApiServer extends EventEmitter {
|
|
|
155
156
|
localEvents = [];
|
|
156
157
|
localEventBytes = 0;
|
|
157
158
|
localEventWaiters = new Set();
|
|
159
|
+
ticketInbox;
|
|
160
|
+
setTicketInbox(inbox) { this.ticketInbox = inbox; }
|
|
158
161
|
localProjects;
|
|
159
162
|
setLocalProjects(list) {
|
|
160
163
|
this.localProjects = list;
|
|
@@ -369,6 +372,32 @@ export class LocalApiServer extends EventEmitter {
|
|
|
369
372
|
if (route.kind !== 'http')
|
|
370
373
|
throw new Error('Invalid application route');
|
|
371
374
|
const routePath = route.path.split('?')[0];
|
|
375
|
+
if (routePath === TICKET_NOTIFICATION_INBOX || routePath === TICKET_NOTIFICATION_WIRE) {
|
|
376
|
+
await this.security.revalidate(message.principal);
|
|
377
|
+
if (!this.ticketInbox)
|
|
378
|
+
return { status: 503, body: { error: 'Ticket inbox unavailable' } };
|
|
379
|
+
const endpoint = message.principal.endpoint;
|
|
380
|
+
if (routePath === TICKET_NOTIFICATION_INBOX) {
|
|
381
|
+
if (endpoint.kind !== 'local-cli')
|
|
382
|
+
return { status: 403, body: { error: 'permission_denied' } };
|
|
383
|
+
const query = new URL(route.path, 'http://localhost').searchParams;
|
|
384
|
+
const after = query.get('after') ?? '0', limit = query.get('limit') ?? '50';
|
|
385
|
+
if (!/^\d+$/.test(after) || !Number.isSafeInteger(Number(after)) ||
|
|
386
|
+
!/^\d+$/.test(limit) || Number(limit) < 1 || Number(limit) > 100)
|
|
387
|
+
return { status: 400, body: { error: 'Invalid notification cursor or limit' } };
|
|
388
|
+
return { status: 200, body: applicationJson(this.ticketInbox.list(Number(after), Number(limit))) };
|
|
389
|
+
}
|
|
390
|
+
const home = this.security.peerBridges().find(peer => peer.endpoint.id === endpoint.id);
|
|
391
|
+
if (endpoint.kind !== 'bridge' || !home)
|
|
392
|
+
return { status: 403, body: { error: 'permission_denied' } };
|
|
393
|
+
const body = message.application.data?.body;
|
|
394
|
+
try {
|
|
395
|
+
return { status: 200, body: { id: this.ticketInbox.receive(home.bridgeId, body) } };
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
return { status: 400, body: { error: 'Could not store ticket notification' } };
|
|
399
|
+
}
|
|
400
|
+
}
|
|
372
401
|
if (routePath === PROJECT_DIRECTORY) {
|
|
373
402
|
const { endpoint } = message.principal;
|
|
374
403
|
if (endpoint.kind !== 'bridge' || !this.security.peerBridges().some(peer => peer.endpoint.id === endpoint.id))
|
|
@@ -2002,7 +2031,7 @@ export class LocalApiServer extends EventEmitter {
|
|
|
2002
2031
|
const conflict = sessions.find((s) => ((tombstone.claudeSessionId && s.claudeSessionId === tombstone.claudeSessionId) ||
|
|
2003
2032
|
(tombstone.cursorSessionId && s.cursorSessionId === tombstone.cursorSessionId) ||
|
|
2004
2033
|
(tombstone.codexSessionId && s.codexSessionId === tombstone.codexSessionId) ||
|
|
2005
|
-
(tombstone.piSessionId && s.piSessionId === tombstone.piSessionId) ||
|
|
2034
|
+
(tombstone.piSessionId && s.shellType === tombstone.shellType && s.piSessionId === tombstone.piSessionId) ||
|
|
2006
2035
|
(tombstone.opencodeSessionId &&
|
|
2007
2036
|
s.opencodeSessionId === tombstone.opencodeSessionId) ||
|
|
2008
2037
|
(tombstone.museSessionId &&
|
|
@@ -2038,6 +2067,7 @@ export class LocalApiServer extends EventEmitter {
|
|
|
2038
2067
|
env: tombstone.env,
|
|
2039
2068
|
shellType: tombstone.shellType,
|
|
2040
2069
|
model: tombstone.model,
|
|
2070
|
+
effort: tombstone.effort,
|
|
2041
2071
|
account: tombstone.account,
|
|
2042
2072
|
allowedAccounts: tombstone.allowedAccounts,
|
|
2043
2073
|
claudeSessionId: tombstone.claudeSessionId,
|