@paigy/harness 0.3.8 → 0.3.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.
- package/dist/cli.js +62 -333
- package/dist/main.js +149 -449
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24062,7 +24062,7 @@ async function subscribeWake(onNudge, opts = {}) {
|
|
|
24062
24062
|
}
|
|
24063
24063
|
};
|
|
24064
24064
|
}
|
|
24065
|
-
var import_undici, require2, __create2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __getProtoOf2, __hasOwnProp2, __require2, __commonJS2, __copyProps2, __toESM2, require_nacl_fast, BACKEND_URL, NETWORK_MSG, PROXY_ENV, agent, INSTANCE_ID, WORKSPACE_ID, envSession, SESSION_ID, ignoreOverride, defaultOptions, getDefaultOptions, getRefs, getRelativePath, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, get$ref, addMeta, zodToJsonSchema, OPTIONS_MIN, OPTIONS_MAX, StartContactSchema, ContactSchema, CONTACT_SCHEMA, CONTACT_DESCRIPTION, CreateGoalSchema, CreateGoalToolSchema, CREATE_GOAL_DESCRIPTION, UpdateGoalSchema, UpdateGoalToolSchema, ClaimGoalSchema, GetGoalSchema, GET_GOAL_DESCRIPTION, UPDATE_GOAL_DESCRIPTION, CLAIM_GOAL_DESCRIPTION, CHECK_REPLIES_DESCRIPTION, CheckRepliesSchema, GetThreadSchema, GET_THREAD_DESCRIPTION, SearchThreadsSchema, SEARCH_THREADS_DESCRIPTION, AGENT_TOOLS, AGENT_TOOL_NAMES, ContextSchema, ParticipantSchema, TransformSchema, OptionSchema, VisualSchema, NotifyLevelSchema, SelectShapeSchema, ReceiptEventSchema, AttentionSchema, NotifyRequestFields, NotifyRequestSchema, NotifyStatusSchema, AgentStateSchema, TurnSchema, UserAnswerSchema, IntentSchema, RideAlongSchema, AwaitItemSchema,
|
|
24065
|
+
var import_undici, require2, __create2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __getProtoOf2, __hasOwnProp2, __require2, __commonJS2, __copyProps2, __toESM2, require_nacl_fast, BACKEND_URL, NETWORK_MSG, PROXY_ENV, agent, INSTANCE_ID, WORKSPACE_ID, envSession, SESSION_ID, ignoreOverride, defaultOptions, getDefaultOptions, getRefs, getRelativePath, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, get$ref, addMeta, zodToJsonSchema, OPTIONS_MIN, OPTIONS_MAX, StartContactSchema, ContactSchema, CONTACT_SCHEMA, CONTACT_DESCRIPTION, CreateGoalSchema, CreateGoalToolSchema, CREATE_GOAL_DESCRIPTION, UpdateGoalSchema, UpdateGoalToolSchema, ClaimGoalSchema, GetGoalSchema, GET_GOAL_DESCRIPTION, UPDATE_GOAL_DESCRIPTION, CLAIM_GOAL_DESCRIPTION, CHECK_REPLIES_DESCRIPTION, CheckRepliesSchema, GetThreadSchema, GET_THREAD_DESCRIPTION, SearchThreadsSchema, SEARCH_THREADS_DESCRIPTION, AGENT_TOOLS, AGENT_TOOL_NAMES, ContextSchema, ParticipantSchema, TransformSchema, OptionSchema, VisualSchema, NotifyLevelSchema, SelectShapeSchema, ReceiptEventSchema, AttentionSchema, NotifyRequestFields, NotifyRequestSchema, NotifyStatusSchema, AgentStateSchema, TurnSchema, UserAnswerSchema, IntentSchema, RideAlongSchema, AwaitItemSchema, VoiceKeySchema, AgendaTurnSchema, CLAIM_STALE_MS, InboxItemSchema, APNS_TOKEN_RE, PushTokenSchema, MissedCallSchema, BrokerTuningSchema, UserSettingsSchema, HistoryItemSchema, ACTIVITY_LINES, ACTIVITY_LINE_MAX, AgentActivitySchema, ConnectionSummarySchema, LedgerItemSchema, AgentLedgerSchema, ReassignResultSchema, MoveRingSchema, MoveSchema, QueueQuestionSchema, QueueItemSchema, NoteSourceSchema, NoteStatusSchema, NoteRepeatSchema, DecisionSchema, NoteSchema, TriageItemSchema, TriageAssignmentSchema, TriageStatusSchema, SubmitTriageSchema, TriageProposalSchema, AcceptTriageSchema, AcceptTriageResultSchema, DeliveryModeSchema, WAKE_EVENT, wakeChannel, RegisterDeliverySchema, OAuthStartSchema, DeliveryConfigSchema, StatusSchema, EnvelopeRecipientSchema, EnvelopeHeaderSchema, EnvelopeSchema, SealedAnswerSchema, DeviceCredentialSchema, DeviceRosterSchema, WakeNudgeSchema, PairingStatusSchema, PairingRevealSchema, DeviceCodeSchema, DeviceInfoSchema, DeviceTokenSchema, SupportRequestSchema, NotificationFeedbackKindSchema, FeedbackResolutionSchema, FeedbackOutcomeSchema, import_tweetnacl, import_tweetnacl2, import_tweetnacl3, import_tweetnacl4, import_tweetnacl5, AGENT_NAME, TOKEN_PATH, KEY_PATH, sleep, UnpairedError, ApiError, AWAIT_WINDOW_MS, tokenOverride, authToken, HEARTBEAT_MS, RETRY_MS, JOIN, lines;
|
|
24066
24066
|
var init_dist = __esm({
|
|
24067
24067
|
"../../packages/sdk/dist/index.js"() {
|
|
24068
24068
|
"use strict";
|
|
@@ -26765,7 +26765,8 @@ var init_dist = __esm({
|
|
|
26765
26765
|
children: external_exports.array(external_exports.object({ outcome: external_exports.string().trim().min(1).max(1e4), ownerParticipant: external_exports.string().trim().min(1), gate: external_exports.enum(["start", "finish"]).optional() }).strict()).optional(),
|
|
26766
26766
|
state: external_exports.enum(["active", "done", "cancelled"]).optional(),
|
|
26767
26767
|
progress: external_exports.string().trim().min(1).max(1e4).optional(),
|
|
26768
|
-
reviewed: external_exports.literal(true).optional()
|
|
26768
|
+
reviewed: external_exports.literal(true).optional(),
|
|
26769
|
+
dueAt: external_exports.string().datetime({ offset: true }).nullable().optional()
|
|
26769
26770
|
}).strict().refine((v) => Object.keys(v).length > 0),
|
|
26770
26771
|
reason: external_exports.string().trim().min(1).max(2e3),
|
|
26771
26772
|
operationId: external_exports.string().uuid().optional()
|
|
@@ -26774,9 +26775,9 @@ var init_dist = __esm({
|
|
|
26774
26775
|
ClaimGoalSchema = external_exports.object({ goalId: external_exports.string().uuid().optional() }).strict();
|
|
26775
26776
|
GetGoalSchema = external_exports.object({ goalId: external_exports.string().uuid() }).strict();
|
|
26776
26777
|
GET_GOAL_DESCRIPTION = "Read the current authorized Goal brief: state, owner, blockers, open decisions, progress, and the next operation. Foreign or sibling-owned Goals are not disclosed.";
|
|
26777
|
-
UPDATE_GOAL_DESCRIPTION = "Update an owned Goal at an exact revision. State, ownership, dependencies, children, progress, and review acknowledgement are explicit; stale revisions are rejected. Returns the new revision and a prose summary.";
|
|
26778
|
+
UPDATE_GOAL_DESCRIPTION = "Update an owned Goal at an exact revision. State, ownership, dependencies, children, progress, and review acknowledgement are explicit; stale revisions are rejected. reviewed: true acknowledges new evidence and closes the Deliveries addressed to you on that Goal, never over an open decision. dueAt (an ISO instant, or null) makes the Goal wait until then; when it passes you are woken for it \u2014 use it for a promise to follow up later. Returns the new revision and a prose summary.";
|
|
26778
26779
|
CLAIM_GOAL_DESCRIPTION = "Claim the oldest runnable or review-pending Goal you own, or pass goalId to claim that Goal. Returns a Goal-scoped brief, current revision, blockers, and the next valid operation. Claiming creates or renews the execution lease.";
|
|
26779
|
-
CHECK_REPLIES_DESCRIPTION = "Your open Deliveries: every Notification or Call currently addressed to you \u2014 a request the user started toward you, an answer relayed to something you asked, a handoff \u2014 each
|
|
26780
|
+
CHECK_REPLIES_DESCRIPTION = "Your open Deliveries: every Notification or Call currently addressed to you \u2014 a request the user started toward you, an answer relayed to something you asked, a handoff \u2014 one row each: its Goals, the newest words in brief, accepted decisions and open decision needs, without the Entries. A pure read with no arguments: nothing is consumed, acknowledged or claimed by reading it, so call it on startup, after a long wait, or whenever you want to know what is outstanding. To act on one, claim its Goal (claim_goal) or reread it in full with contact({deliveryId}). Once you have acted on what arrived, update_goal with reviewed: true closes the Deliveries addressed to you on that Goal. Your runnable and review-pending Goals come from claim_goal, not from here.";
|
|
26780
26781
|
CheckRepliesSchema = external_exports.object({}).strict();
|
|
26781
26782
|
GetThreadSchema = external_exports.object({
|
|
26782
26783
|
parentId: external_exports.string().describe("The Thread to read \u2014 the threadId a Delivery returned, or the parentId of a search hit.")
|
|
@@ -27155,67 +27156,6 @@ var init_dist = __esm({
|
|
|
27155
27156
|
inFlight: external_exports.boolean().optional()
|
|
27156
27157
|
})
|
|
27157
27158
|
]);
|
|
27158
|
-
CallbackTriggerSchema = external_exports.enum(["on_done", "on_blocked", "scheduled"]);
|
|
27159
|
-
NotifyResponseSchema = external_exports.object({
|
|
27160
|
-
notificationId: external_exports.string(),
|
|
27161
|
-
workId: external_exports.string().uuid().optional(),
|
|
27162
|
-
decisionId: external_exports.string().uuid().optional(),
|
|
27163
|
-
status: NotifyStatusSchema,
|
|
27164
|
-
createdAt: external_exports.string().datetime(),
|
|
27165
|
-
answer: UserAnswerSchema.optional(),
|
|
27166
|
-
answeredAt: external_exports.string().datetime().optional(),
|
|
27167
|
-
/** Ride-alongs for THIS agent — pending work it should pick up when it's done with
|
|
27168
|
-
* what it came for. Present on any reply, because an unwakeable agent's only
|
|
27169
|
-
* reliable moment is one it initiated. Absent/empty = nothing owed. */
|
|
27170
|
-
also: external_exports.array(RideAlongSchema).optional()
|
|
27171
|
-
});
|
|
27172
|
-
NotifyPlanUnitSchema = external_exports.object({
|
|
27173
|
-
notificationId: external_exports.string(),
|
|
27174
|
-
/** The unit's own heading, so the agent can tell which of its paragraphs this became. */
|
|
27175
|
-
title: external_exports.string(),
|
|
27176
|
-
/** How loudly this unit was arbitrated to arrive — per unit, which is the point of units. */
|
|
27177
|
-
level: NotifyLevelSchema,
|
|
27178
|
-
/** Answered from something the user already decided: nobody is interrupted, and a trail card
|
|
27179
|
-
* says so. The agent should not wait on this one. */
|
|
27180
|
-
settled: external_exports.literal(true).optional(),
|
|
27181
|
-
/** What this unit would need to be answerable and does not carry (#894). A PROPOSAL to the
|
|
27182
|
-
* agent — nothing here changed the ask, and ignoring it costs nothing. */
|
|
27183
|
-
needs: external_exports.array(external_exports.enum(["options", "visuals"])).optional(),
|
|
27184
|
-
/** The SHAPE the broker would give this unit, for the agent to ratify (#886/#894). The
|
|
27185
|
-
* split layer reads prose and can see that a paragraph is a yes/no or a pick-one — but a
|
|
27186
|
-
* broker that DECIDES that destroys the only fact separating a statement from a real ask
|
|
27187
|
-
* (#731), so it is offered, never applied: the unit is stored `text` until the agent
|
|
27188
|
-
* confirms the shape (POST /notify/:id/confirm). Ignoring it costs nothing. */
|
|
27189
|
-
proposal: external_exports.object({
|
|
27190
|
-
select: SelectShapeSchema,
|
|
27191
|
-
options: external_exports.array(external_exports.object({ label: external_exports.string().min(1) })).optional()
|
|
27192
|
-
}).optional(),
|
|
27193
|
-
/** What the broker READ this unit as wanting from the human (#952 layer 2): a `decision`
|
|
27194
|
-
* between alternatives, an `approval` the agent is blocked on, or `knowledge` it just
|
|
27195
|
-
* needs to know. Reported so the agent can correct a misread the same way it ratifies a
|
|
27196
|
-
* shape — the read RAISES (a decision always asks) and never silences a question the
|
|
27197
|
-
* agent declared (#731, #923). */
|
|
27198
|
-
wants: external_exports.enum(["decision", "approval", "knowledge"]).optional()
|
|
27199
|
-
});
|
|
27200
|
-
NotifyPlanSchema = external_exports.object({
|
|
27201
|
-
units: external_exports.array(NotifyPlanUnitSchema),
|
|
27202
|
-
/** Which unit is this arrival's ONE interruption (units-design.md D23). Absent means nobody
|
|
27203
|
-
* was interrupted — every unit was either settled or quiet enough to sit in the inbox. */
|
|
27204
|
-
speaks: external_exports.string().optional()
|
|
27205
|
-
});
|
|
27206
|
-
UserResponseSchema = external_exports.object({
|
|
27207
|
-
requestId: external_exports.string(),
|
|
27208
|
-
answer: UserAnswerSchema,
|
|
27209
|
-
answeredAt: external_exports.string().datetime(),
|
|
27210
|
-
transcript: external_exports.string().optional(),
|
|
27211
|
-
/** E2EE: the sealed answer (opaque envelope + plaintext `ignored` hint) when the item was
|
|
27212
|
-
* E2EE-sealed. Present → the server persists it opaquely and branches status on `ignored`;
|
|
27213
|
-
* the plaintext `answer` is a placeholder (`{ kind: "ignored" }`) the server ignores for a
|
|
27214
|
-
* sealed row. Absent = today's plaintext answer, unchanged. */
|
|
27215
|
-
sealed: external_exports.lazy(() => SealedAnswerSchema).optional(),
|
|
27216
|
-
/** Coverage report (#396): which of the ask's declared `points` were addressed. */
|
|
27217
|
-
covered: external_exports.array(external_exports.string()).optional()
|
|
27218
|
-
});
|
|
27219
27159
|
VoiceKeySchema = external_exports.enum(["rachel", "george", "jessica", "brian", "lily"]);
|
|
27220
27160
|
AgendaTurnSchema = external_exports.object({
|
|
27221
27161
|
/** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
|
|
@@ -27399,10 +27339,6 @@ var init_dist = __esm({
|
|
|
27399
27339
|
goalState: external_exports.string().optional()
|
|
27400
27340
|
}).optional()
|
|
27401
27341
|
});
|
|
27402
|
-
SnoozeRequestSchema = external_exports.object({
|
|
27403
|
-
requestId: external_exports.string(),
|
|
27404
|
-
until: external_exports.string().datetime()
|
|
27405
|
-
});
|
|
27406
27342
|
APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
|
|
27407
27343
|
PushTokenSchema = external_exports.object({
|
|
27408
27344
|
voipToken: external_exports.string().min(1).optional(),
|
|
@@ -27623,19 +27559,6 @@ var init_dist = __esm({
|
|
|
27623
27559
|
* distilled from a clarify ruling (those carry no agent) or one whose source rows are gone. */
|
|
27624
27560
|
learnedFrom: external_exports.object({ id: external_exports.string(), name: external_exports.string() }).nullable()
|
|
27625
27561
|
});
|
|
27626
|
-
CreateRequestSchema = external_exports.object({
|
|
27627
|
-
/** The connection (token id) to send to, from GET /api/tokens. */
|
|
27628
|
-
tokenId: external_exports.string(),
|
|
27629
|
-
/** The user's message to the agent. */
|
|
27630
|
-
text: external_exports.string().min(1),
|
|
27631
|
-
/** Land the request on an existing conversation thread (History → "Continue")
|
|
27632
|
-
* instead of minting a fresh one. Must belong to the requesting user. */
|
|
27633
|
-
parentId: external_exports.string().optional(),
|
|
27634
|
-
/** Point the agent at a past conversation (possibly with a different agent) as
|
|
27635
|
-
* starting context (History → "New session from this"). A reference, not a copy —
|
|
27636
|
-
* the agent reads it via get_thread. Must belong to the requesting user. */
|
|
27637
|
-
contextParentId: external_exports.string().optional()
|
|
27638
|
-
});
|
|
27639
27562
|
QueueQuestionSchema = external_exports.object({
|
|
27640
27563
|
/** The decision need's id — what an answer is accepted against. */
|
|
27641
27564
|
id: external_exports.string(),
|
|
@@ -27727,38 +27650,6 @@ var init_dist = __esm({
|
|
|
27727
27650
|
lastRideAt: external_exports.string().nullable().default(null),
|
|
27728
27651
|
createdAt: external_exports.string()
|
|
27729
27652
|
});
|
|
27730
|
-
CreateNoteSchema = external_exports.object({
|
|
27731
|
-
/** The intent, in the user's own words. Stored verbatim; the broker only titles it. */
|
|
27732
|
-
text: external_exports.string().min(1).max(4e3),
|
|
27733
|
-
/** Capture it as a REMINDER — a note assigned to the user themselves, which rides
|
|
27734
|
-
* their next call instead of being handed to an agent. Everything else about the
|
|
27735
|
-
* note is identical; this is the one parameter that separates the two. */
|
|
27736
|
-
forMe: external_exports.boolean().optional(),
|
|
27737
|
-
/** The not-before, when the user already said one. Absent = the very next call. */
|
|
27738
|
-
dueAt: external_exports.string().datetime().optional(),
|
|
27739
|
-
repeat: NoteRepeatSchema.optional()
|
|
27740
|
-
});
|
|
27741
|
-
RecordDecisionSchema = external_exports.object({
|
|
27742
|
-
/** An open decision (from /clarify) to answer. */
|
|
27743
|
-
decisionId: external_exports.string().optional(),
|
|
27744
|
-
/** For an ad-hoc decision: what was ambiguous. Required without `decisionId`. */
|
|
27745
|
-
question: external_exports.string().min(1).max(500).optional(),
|
|
27746
|
-
/** The ruling. */
|
|
27747
|
-
answer: external_exports.string().min(1).max(2e3)
|
|
27748
|
-
}).refine((d) => d.decisionId || d.question, { message: "decisionId or question required" });
|
|
27749
|
-
AssignNoteSchema = external_exports.object({
|
|
27750
|
-
/** An EXISTING agent: token id or nickname. Omit when spawning fresh. */
|
|
27751
|
-
target: external_exports.string().min(1).optional(),
|
|
27752
|
-
/** Spawn a NEW session for this note (companion.md §2.2): the assignee doesn't
|
|
27753
|
-
* exist yet — mint it on a live desktop that advertises the harness+workspace,
|
|
27754
|
-
* named after the note. The brief arrives as its opening request. */
|
|
27755
|
-
spawn: external_exports.object({
|
|
27756
|
-
hostTokenId: external_exports.string().uuid(),
|
|
27757
|
-
harness: external_exports.string().min(1),
|
|
27758
|
-
workspace: external_exports.string().min(1)
|
|
27759
|
-
}).optional()
|
|
27760
|
-
}).refine((a) => !!a.target !== !!a.spawn, { message: "exactly one of target or spawn" });
|
|
27761
|
-
TriageVerdictSchema = external_exports.enum(["keep", "stale", "close", "assign"]);
|
|
27762
27653
|
TriageItemSchema = external_exports.object({
|
|
27763
27654
|
noteId: external_exports.string(),
|
|
27764
27655
|
/** The note's headline at run time. */
|
|
@@ -27894,20 +27785,6 @@ var init_dist = __esm({
|
|
|
27894
27785
|
ed25519: external_exports.string(),
|
|
27895
27786
|
nonce: external_exports.string()
|
|
27896
27787
|
});
|
|
27897
|
-
DeviceCodeRequestSchema = external_exports.object({
|
|
27898
|
-
/** The agent's suggested name for the pairing — the human sees it pre-filled at
|
|
27899
|
-
* approval and can override. Optional; blank → a default silly name server-side. */
|
|
27900
|
-
suggestedName: external_exports.string().optional(),
|
|
27901
|
-
/** Legacy alias for suggestedName (older MCPs sent `agent`). Accepted for
|
|
27902
|
-
* back-compat; `suggestedName` wins when both are present. ponytail: drop once no
|
|
27903
|
-
* pre-`name` MCP is in the wild. */
|
|
27904
|
-
agent: external_exports.union([external_exports.string(), external_exports.object({ name: external_exports.string().optional() })]).optional(),
|
|
27905
|
-
device: external_exports.string().optional(),
|
|
27906
|
-
proto: external_exports.string().optional(),
|
|
27907
|
-
// compiled-in tag, e.g. "paigy-pair-v2|sas=24"
|
|
27908
|
-
commitment: external_exports.string().optional()
|
|
27909
|
-
// agent's Ca
|
|
27910
|
-
});
|
|
27911
27788
|
DeviceCodeSchema = external_exports.object({
|
|
27912
27789
|
device_code: external_exports.string(),
|
|
27913
27790
|
user_code: external_exports.string(),
|
|
@@ -27941,11 +27818,6 @@ var init_dist = __esm({
|
|
|
27941
27818
|
phone_reveal: PairingRevealSchema.nullable().optional(),
|
|
27942
27819
|
uik_pub: external_exports.string().nullable().optional()
|
|
27943
27820
|
});
|
|
27944
|
-
DeviceTokenRequestSchema = external_exports.object({
|
|
27945
|
-
device_code: external_exports.string(),
|
|
27946
|
-
reveal: PairingRevealSchema.optional()
|
|
27947
|
-
// agent's reveal {x25519, ed25519, nonce}
|
|
27948
|
-
});
|
|
27949
27821
|
DeviceTokenSchema = external_exports.object({
|
|
27950
27822
|
access_token: external_exports.string(),
|
|
27951
27823
|
/** The pairing's single name (user-typed at approval, the agent's suggestion, or
|
|
@@ -27967,14 +27839,6 @@ var init_dist = __esm({
|
|
|
27967
27839
|
// present once the phone reveals
|
|
27968
27840
|
uik_pub: external_exports.string().nullable().optional()
|
|
27969
27841
|
});
|
|
27970
|
-
DeviceCommitRequestSchema = external_exports.object({
|
|
27971
|
-
code: external_exports.string(),
|
|
27972
|
-
commitment: external_exports.string()
|
|
27973
|
-
// Cb
|
|
27974
|
-
});
|
|
27975
|
-
DevicePeerCommitSchema = external_exports.object({
|
|
27976
|
-
commitment: external_exports.string().nullable()
|
|
27977
|
-
});
|
|
27978
27842
|
SupportRequestSchema = external_exports.object({
|
|
27979
27843
|
email: external_exports.string().email().max(320),
|
|
27980
27844
|
message: external_exports.string().trim().min(1).max(5e3),
|
|
@@ -27994,15 +27858,6 @@ var init_dist = __esm({
|
|
|
27994
27858
|
"other"
|
|
27995
27859
|
// anything else — the note carries it.
|
|
27996
27860
|
]);
|
|
27997
|
-
NotificationFeedbackSchema = external_exports.object({
|
|
27998
|
-
notificationId: external_exports.string(),
|
|
27999
|
-
kind: NotificationFeedbackKindSchema,
|
|
28000
|
-
/** Optional free-text elaboration for a preset; required (non-empty) for 'other'. */
|
|
28001
|
-
note: external_exports.string().trim().max(2e3).optional()
|
|
28002
|
-
}).superRefine((r, ctx) => {
|
|
28003
|
-
if (r.kind === "other" && !r.note)
|
|
28004
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["note"], message: "note is required for 'other' feedback" });
|
|
28005
|
-
});
|
|
28006
27861
|
FeedbackResolutionSchema = external_exports.enum(["broker_fixed", "sent_to_agent"]);
|
|
28007
27862
|
FeedbackOutcomeSchema = external_exports.object({
|
|
28008
27863
|
resolution: FeedbackResolutionSchema,
|
|
@@ -33273,13 +33128,26 @@ function parseArgs(argv) {
|
|
|
33273
33128
|
return args;
|
|
33274
33129
|
}
|
|
33275
33130
|
var ENABLE_TOOLS_COMMAND = "npx -y -p @paigy/mcp@latest paigy-enable-tools";
|
|
33131
|
+
function onEnter(input, onLine) {
|
|
33132
|
+
if (!input.isTTY) return () => {
|
|
33133
|
+
};
|
|
33134
|
+
const listen = (chunk) => {
|
|
33135
|
+
if (/[\r\n]/.test(String(chunk))) onLine();
|
|
33136
|
+
};
|
|
33137
|
+
input.on("data", listen);
|
|
33138
|
+
input.resume();
|
|
33139
|
+
return () => {
|
|
33140
|
+
input.off("data", listen);
|
|
33141
|
+
input.pause();
|
|
33142
|
+
};
|
|
33143
|
+
}
|
|
33276
33144
|
|
|
33277
33145
|
// src/cli.ts
|
|
33278
33146
|
init_dist();
|
|
33279
33147
|
var import_qrcode = __toESM(require_lib(), 1);
|
|
33280
33148
|
import { hostname } from "os";
|
|
33281
33149
|
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
33282
|
-
import { execSync } from "child_process";
|
|
33150
|
+
import { execFile as execFile2, execSync } from "child_process";
|
|
33283
33151
|
import { homedir as homedir7 } from "os";
|
|
33284
33152
|
import { join as join6 } from "path";
|
|
33285
33153
|
|
|
@@ -34965,7 +34833,8 @@ var UpdateGoalSchema2 = external_exports.object({
|
|
|
34965
34833
|
children: external_exports.array(external_exports.object({ outcome: external_exports.string().trim().min(1).max(1e4), ownerParticipant: external_exports.string().trim().min(1), gate: external_exports.enum(["start", "finish"]).optional() }).strict()).optional(),
|
|
34966
34834
|
state: external_exports.enum(["active", "done", "cancelled"]).optional(),
|
|
34967
34835
|
progress: external_exports.string().trim().min(1).max(1e4).optional(),
|
|
34968
|
-
reviewed: external_exports.literal(true).optional()
|
|
34836
|
+
reviewed: external_exports.literal(true).optional(),
|
|
34837
|
+
dueAt: external_exports.string().datetime({ offset: true }).nullable().optional()
|
|
34969
34838
|
}).strict().refine((v) => Object.keys(v).length > 0),
|
|
34970
34839
|
reason: external_exports.string().trim().min(1).max(2e3),
|
|
34971
34840
|
operationId: external_exports.string().uuid().optional()
|
|
@@ -34974,9 +34843,9 @@ var UpdateGoalToolSchema2 = UpdateGoalSchema2.omit({ operationId: true }).extend
|
|
|
34974
34843
|
var ClaimGoalSchema2 = external_exports.object({ goalId: external_exports.string().uuid().optional() }).strict();
|
|
34975
34844
|
var GetGoalSchema2 = external_exports.object({ goalId: external_exports.string().uuid() }).strict();
|
|
34976
34845
|
var GET_GOAL_DESCRIPTION2 = "Read the current authorized Goal brief: state, owner, blockers, open decisions, progress, and the next operation. Foreign or sibling-owned Goals are not disclosed.";
|
|
34977
|
-
var UPDATE_GOAL_DESCRIPTION2 = "Update an owned Goal at an exact revision. State, ownership, dependencies, children, progress, and review acknowledgement are explicit; stale revisions are rejected. Returns the new revision and a prose summary.";
|
|
34846
|
+
var UPDATE_GOAL_DESCRIPTION2 = "Update an owned Goal at an exact revision. State, ownership, dependencies, children, progress, and review acknowledgement are explicit; stale revisions are rejected. reviewed: true acknowledges new evidence and closes the Deliveries addressed to you on that Goal, never over an open decision. dueAt (an ISO instant, or null) makes the Goal wait until then; when it passes you are woken for it \u2014 use it for a promise to follow up later. Returns the new revision and a prose summary.";
|
|
34978
34847
|
var CLAIM_GOAL_DESCRIPTION2 = "Claim the oldest runnable or review-pending Goal you own, or pass goalId to claim that Goal. Returns a Goal-scoped brief, current revision, blockers, and the next valid operation. Claiming creates or renews the execution lease.";
|
|
34979
|
-
var CHECK_REPLIES_DESCRIPTION2 = "Your open Deliveries: every Notification or Call currently addressed to you \u2014 a request the user started toward you, an answer relayed to something you asked, a handoff \u2014 each
|
|
34848
|
+
var CHECK_REPLIES_DESCRIPTION2 = "Your open Deliveries: every Notification or Call currently addressed to you \u2014 a request the user started toward you, an answer relayed to something you asked, a handoff \u2014 one row each: its Goals, the newest words in brief, accepted decisions and open decision needs, without the Entries. A pure read with no arguments: nothing is consumed, acknowledged or claimed by reading it, so call it on startup, after a long wait, or whenever you want to know what is outstanding. To act on one, claim its Goal (claim_goal) or reread it in full with contact({deliveryId}). Once you have acted on what arrived, update_goal with reviewed: true closes the Deliveries addressed to you on that Goal. Your runnable and review-pending Goals come from claim_goal, not from here.";
|
|
34980
34849
|
var CheckRepliesSchema2 = external_exports.object({}).strict();
|
|
34981
34850
|
var GetThreadSchema2 = external_exports.object({
|
|
34982
34851
|
parentId: external_exports.string().describe("The Thread to read \u2014 the threadId a Delivery returned, or the parentId of a search hit.")
|
|
@@ -35370,67 +35239,6 @@ var AwaitItemSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
35370
35239
|
inFlight: external_exports.boolean().optional()
|
|
35371
35240
|
})
|
|
35372
35241
|
]);
|
|
35373
|
-
var CallbackTriggerSchema2 = external_exports.enum(["on_done", "on_blocked", "scheduled"]);
|
|
35374
|
-
var NotifyResponseSchema2 = external_exports.object({
|
|
35375
|
-
notificationId: external_exports.string(),
|
|
35376
|
-
workId: external_exports.string().uuid().optional(),
|
|
35377
|
-
decisionId: external_exports.string().uuid().optional(),
|
|
35378
|
-
status: NotifyStatusSchema2,
|
|
35379
|
-
createdAt: external_exports.string().datetime(),
|
|
35380
|
-
answer: UserAnswerSchema2.optional(),
|
|
35381
|
-
answeredAt: external_exports.string().datetime().optional(),
|
|
35382
|
-
/** Ride-alongs for THIS agent — pending work it should pick up when it's done with
|
|
35383
|
-
* what it came for. Present on any reply, because an unwakeable agent's only
|
|
35384
|
-
* reliable moment is one it initiated. Absent/empty = nothing owed. */
|
|
35385
|
-
also: external_exports.array(RideAlongSchema2).optional()
|
|
35386
|
-
});
|
|
35387
|
-
var NotifyPlanUnitSchema2 = external_exports.object({
|
|
35388
|
-
notificationId: external_exports.string(),
|
|
35389
|
-
/** The unit's own heading, so the agent can tell which of its paragraphs this became. */
|
|
35390
|
-
title: external_exports.string(),
|
|
35391
|
-
/** How loudly this unit was arbitrated to arrive — per unit, which is the point of units. */
|
|
35392
|
-
level: NotifyLevelSchema2,
|
|
35393
|
-
/** Answered from something the user already decided: nobody is interrupted, and a trail card
|
|
35394
|
-
* says so. The agent should not wait on this one. */
|
|
35395
|
-
settled: external_exports.literal(true).optional(),
|
|
35396
|
-
/** What this unit would need to be answerable and does not carry (#894). A PROPOSAL to the
|
|
35397
|
-
* agent — nothing here changed the ask, and ignoring it costs nothing. */
|
|
35398
|
-
needs: external_exports.array(external_exports.enum(["options", "visuals"])).optional(),
|
|
35399
|
-
/** The SHAPE the broker would give this unit, for the agent to ratify (#886/#894). The
|
|
35400
|
-
* split layer reads prose and can see that a paragraph is a yes/no or a pick-one — but a
|
|
35401
|
-
* broker that DECIDES that destroys the only fact separating a statement from a real ask
|
|
35402
|
-
* (#731), so it is offered, never applied: the unit is stored `text` until the agent
|
|
35403
|
-
* confirms the shape (POST /notify/:id/confirm). Ignoring it costs nothing. */
|
|
35404
|
-
proposal: external_exports.object({
|
|
35405
|
-
select: SelectShapeSchema2,
|
|
35406
|
-
options: external_exports.array(external_exports.object({ label: external_exports.string().min(1) })).optional()
|
|
35407
|
-
}).optional(),
|
|
35408
|
-
/** What the broker READ this unit as wanting from the human (#952 layer 2): a `decision`
|
|
35409
|
-
* between alternatives, an `approval` the agent is blocked on, or `knowledge` it just
|
|
35410
|
-
* needs to know. Reported so the agent can correct a misread the same way it ratifies a
|
|
35411
|
-
* shape — the read RAISES (a decision always asks) and never silences a question the
|
|
35412
|
-
* agent declared (#731, #923). */
|
|
35413
|
-
wants: external_exports.enum(["decision", "approval", "knowledge"]).optional()
|
|
35414
|
-
});
|
|
35415
|
-
var NotifyPlanSchema2 = external_exports.object({
|
|
35416
|
-
units: external_exports.array(NotifyPlanUnitSchema2),
|
|
35417
|
-
/** Which unit is this arrival's ONE interruption (units-design.md D23). Absent means nobody
|
|
35418
|
-
* was interrupted — every unit was either settled or quiet enough to sit in the inbox. */
|
|
35419
|
-
speaks: external_exports.string().optional()
|
|
35420
|
-
});
|
|
35421
|
-
var UserResponseSchema2 = external_exports.object({
|
|
35422
|
-
requestId: external_exports.string(),
|
|
35423
|
-
answer: UserAnswerSchema2,
|
|
35424
|
-
answeredAt: external_exports.string().datetime(),
|
|
35425
|
-
transcript: external_exports.string().optional(),
|
|
35426
|
-
/** E2EE: the sealed answer (opaque envelope + plaintext `ignored` hint) when the item was
|
|
35427
|
-
* E2EE-sealed. Present → the server persists it opaquely and branches status on `ignored`;
|
|
35428
|
-
* the plaintext `answer` is a placeholder (`{ kind: "ignored" }`) the server ignores for a
|
|
35429
|
-
* sealed row. Absent = today's plaintext answer, unchanged. */
|
|
35430
|
-
sealed: external_exports.lazy(() => SealedAnswerSchema2).optional(),
|
|
35431
|
-
/** Coverage report (#396): which of the ask's declared `points` were addressed. */
|
|
35432
|
-
covered: external_exports.array(external_exports.string()).optional()
|
|
35433
|
-
});
|
|
35434
35242
|
var VoiceKeySchema2 = external_exports.enum(["rachel", "george", "jessica", "brian", "lily"]);
|
|
35435
35243
|
var AgendaTurnSchema2 = external_exports.object({
|
|
35436
35244
|
/** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
|
|
@@ -35614,10 +35422,6 @@ var InboxItemSchema2 = external_exports.object({
|
|
|
35614
35422
|
goalState: external_exports.string().optional()
|
|
35615
35423
|
}).optional()
|
|
35616
35424
|
});
|
|
35617
|
-
var SnoozeRequestSchema2 = external_exports.object({
|
|
35618
|
-
requestId: external_exports.string(),
|
|
35619
|
-
until: external_exports.string().datetime()
|
|
35620
|
-
});
|
|
35621
35425
|
var APNS_TOKEN_RE2 = /^[0-9a-fA-F]{64}$/;
|
|
35622
35426
|
var PushTokenSchema2 = external_exports.object({
|
|
35623
35427
|
voipToken: external_exports.string().min(1).optional(),
|
|
@@ -35838,19 +35642,6 @@ var MoveSchema2 = external_exports.object({
|
|
|
35838
35642
|
* distilled from a clarify ruling (those carry no agent) or one whose source rows are gone. */
|
|
35839
35643
|
learnedFrom: external_exports.object({ id: external_exports.string(), name: external_exports.string() }).nullable()
|
|
35840
35644
|
});
|
|
35841
|
-
var CreateRequestSchema2 = external_exports.object({
|
|
35842
|
-
/** The connection (token id) to send to, from GET /api/tokens. */
|
|
35843
|
-
tokenId: external_exports.string(),
|
|
35844
|
-
/** The user's message to the agent. */
|
|
35845
|
-
text: external_exports.string().min(1),
|
|
35846
|
-
/** Land the request on an existing conversation thread (History → "Continue")
|
|
35847
|
-
* instead of minting a fresh one. Must belong to the requesting user. */
|
|
35848
|
-
parentId: external_exports.string().optional(),
|
|
35849
|
-
/** Point the agent at a past conversation (possibly with a different agent) as
|
|
35850
|
-
* starting context (History → "New session from this"). A reference, not a copy —
|
|
35851
|
-
* the agent reads it via get_thread. Must belong to the requesting user. */
|
|
35852
|
-
contextParentId: external_exports.string().optional()
|
|
35853
|
-
});
|
|
35854
35645
|
var QueueQuestionSchema2 = external_exports.object({
|
|
35855
35646
|
/** The decision need's id — what an answer is accepted against. */
|
|
35856
35647
|
id: external_exports.string(),
|
|
@@ -35942,38 +35733,6 @@ var NoteSchema2 = external_exports.object({
|
|
|
35942
35733
|
lastRideAt: external_exports.string().nullable().default(null),
|
|
35943
35734
|
createdAt: external_exports.string()
|
|
35944
35735
|
});
|
|
35945
|
-
var CreateNoteSchema2 = external_exports.object({
|
|
35946
|
-
/** The intent, in the user's own words. Stored verbatim; the broker only titles it. */
|
|
35947
|
-
text: external_exports.string().min(1).max(4e3),
|
|
35948
|
-
/** Capture it as a REMINDER — a note assigned to the user themselves, which rides
|
|
35949
|
-
* their next call instead of being handed to an agent. Everything else about the
|
|
35950
|
-
* note is identical; this is the one parameter that separates the two. */
|
|
35951
|
-
forMe: external_exports.boolean().optional(),
|
|
35952
|
-
/** The not-before, when the user already said one. Absent = the very next call. */
|
|
35953
|
-
dueAt: external_exports.string().datetime().optional(),
|
|
35954
|
-
repeat: NoteRepeatSchema2.optional()
|
|
35955
|
-
});
|
|
35956
|
-
var RecordDecisionSchema2 = external_exports.object({
|
|
35957
|
-
/** An open decision (from /clarify) to answer. */
|
|
35958
|
-
decisionId: external_exports.string().optional(),
|
|
35959
|
-
/** For an ad-hoc decision: what was ambiguous. Required without `decisionId`. */
|
|
35960
|
-
question: external_exports.string().min(1).max(500).optional(),
|
|
35961
|
-
/** The ruling. */
|
|
35962
|
-
answer: external_exports.string().min(1).max(2e3)
|
|
35963
|
-
}).refine((d) => d.decisionId || d.question, { message: "decisionId or question required" });
|
|
35964
|
-
var AssignNoteSchema2 = external_exports.object({
|
|
35965
|
-
/** An EXISTING agent: token id or nickname. Omit when spawning fresh. */
|
|
35966
|
-
target: external_exports.string().min(1).optional(),
|
|
35967
|
-
/** Spawn a NEW session for this note (companion.md §2.2): the assignee doesn't
|
|
35968
|
-
* exist yet — mint it on a live desktop that advertises the harness+workspace,
|
|
35969
|
-
* named after the note. The brief arrives as its opening request. */
|
|
35970
|
-
spawn: external_exports.object({
|
|
35971
|
-
hostTokenId: external_exports.string().uuid(),
|
|
35972
|
-
harness: external_exports.string().min(1),
|
|
35973
|
-
workspace: external_exports.string().min(1)
|
|
35974
|
-
}).optional()
|
|
35975
|
-
}).refine((a) => !!a.target !== !!a.spawn, { message: "exactly one of target or spawn" });
|
|
35976
|
-
var TriageVerdictSchema2 = external_exports.enum(["keep", "stale", "close", "assign"]);
|
|
35977
35736
|
var TriageItemSchema2 = external_exports.object({
|
|
35978
35737
|
noteId: external_exports.string(),
|
|
35979
35738
|
/** The note's headline at run time. */
|
|
@@ -36107,20 +35866,6 @@ var PairingRevealSchema2 = external_exports.object({
|
|
|
36107
35866
|
ed25519: external_exports.string(),
|
|
36108
35867
|
nonce: external_exports.string()
|
|
36109
35868
|
});
|
|
36110
|
-
var DeviceCodeRequestSchema2 = external_exports.object({
|
|
36111
|
-
/** The agent's suggested name for the pairing — the human sees it pre-filled at
|
|
36112
|
-
* approval and can override. Optional; blank → a default silly name server-side. */
|
|
36113
|
-
suggestedName: external_exports.string().optional(),
|
|
36114
|
-
/** Legacy alias for suggestedName (older MCPs sent `agent`). Accepted for
|
|
36115
|
-
* back-compat; `suggestedName` wins when both are present. ponytail: drop once no
|
|
36116
|
-
* pre-`name` MCP is in the wild. */
|
|
36117
|
-
agent: external_exports.union([external_exports.string(), external_exports.object({ name: external_exports.string().optional() })]).optional(),
|
|
36118
|
-
device: external_exports.string().optional(),
|
|
36119
|
-
proto: external_exports.string().optional(),
|
|
36120
|
-
// compiled-in tag, e.g. "paigy-pair-v2|sas=24"
|
|
36121
|
-
commitment: external_exports.string().optional()
|
|
36122
|
-
// agent's Ca
|
|
36123
|
-
});
|
|
36124
35869
|
var DeviceCodeSchema2 = external_exports.object({
|
|
36125
35870
|
device_code: external_exports.string(),
|
|
36126
35871
|
user_code: external_exports.string(),
|
|
@@ -36154,11 +35899,6 @@ var DeviceInfoSchema2 = external_exports.object({
|
|
|
36154
35899
|
phone_reveal: PairingRevealSchema2.nullable().optional(),
|
|
36155
35900
|
uik_pub: external_exports.string().nullable().optional()
|
|
36156
35901
|
});
|
|
36157
|
-
var DeviceTokenRequestSchema2 = external_exports.object({
|
|
36158
|
-
device_code: external_exports.string(),
|
|
36159
|
-
reveal: PairingRevealSchema2.optional()
|
|
36160
|
-
// agent's reveal {x25519, ed25519, nonce}
|
|
36161
|
-
});
|
|
36162
35902
|
var DeviceTokenSchema2 = external_exports.object({
|
|
36163
35903
|
access_token: external_exports.string(),
|
|
36164
35904
|
/** The pairing's single name (user-typed at approval, the agent's suggestion, or
|
|
@@ -36180,14 +35920,6 @@ var DeviceTokenSchema2 = external_exports.object({
|
|
|
36180
35920
|
// present once the phone reveals
|
|
36181
35921
|
uik_pub: external_exports.string().nullable().optional()
|
|
36182
35922
|
});
|
|
36183
|
-
var DeviceCommitRequestSchema2 = external_exports.object({
|
|
36184
|
-
code: external_exports.string(),
|
|
36185
|
-
commitment: external_exports.string()
|
|
36186
|
-
// Cb
|
|
36187
|
-
});
|
|
36188
|
-
var DevicePeerCommitSchema2 = external_exports.object({
|
|
36189
|
-
commitment: external_exports.string().nullable()
|
|
36190
|
-
});
|
|
36191
35923
|
var SupportRequestSchema2 = external_exports.object({
|
|
36192
35924
|
email: external_exports.string().email().max(320),
|
|
36193
35925
|
message: external_exports.string().trim().min(1).max(5e3),
|
|
@@ -36207,15 +35939,6 @@ var NotificationFeedbackKindSchema2 = external_exports.enum([
|
|
|
36207
35939
|
"other"
|
|
36208
35940
|
// anything else — the note carries it.
|
|
36209
35941
|
]);
|
|
36210
|
-
var NotificationFeedbackSchema2 = external_exports.object({
|
|
36211
|
-
notificationId: external_exports.string(),
|
|
36212
|
-
kind: NotificationFeedbackKindSchema2,
|
|
36213
|
-
/** Optional free-text elaboration for a preset; required (non-empty) for 'other'. */
|
|
36214
|
-
note: external_exports.string().trim().max(2e3).optional()
|
|
36215
|
-
}).superRefine((r, ctx) => {
|
|
36216
|
-
if (r.kind === "other" && !r.note)
|
|
36217
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["note"], message: "note is required for 'other' feedback" });
|
|
36218
|
-
});
|
|
36219
35942
|
var FeedbackResolutionSchema2 = external_exports.enum(["broker_fixed", "sent_to_agent"]);
|
|
36220
35943
|
var FeedbackOutcomeSchema2 = external_exports.object({
|
|
36221
35944
|
resolution: FeedbackResolutionSchema2,
|
|
@@ -36938,11 +36661,35 @@ function bridgeLine(r) {
|
|
|
36938
36661
|
|
|
36939
36662
|
// src/cli.ts
|
|
36940
36663
|
var STATUS_MARK = { ready: "\u2713", login: "\u25D0", "adapter-missing": "\u25D0", missing: "\u2717" };
|
|
36941
|
-
function printConnectLines(link, userCode) {
|
|
36664
|
+
function printConnectLines(link, userCode, enter) {
|
|
36942
36665
|
console.log("Connect this computer from your phone");
|
|
36943
|
-
console.log(` Open ${link}`);
|
|
36666
|
+
console.log(` Open ${link}${enter ? " (press Enter to open it here)" : ""}`);
|
|
36944
36667
|
console.log(` or scan the QR above \xB7 or type ${userCode} in Paigy \u2192 Devices \u2192 Connect a computer`);
|
|
36945
36668
|
}
|
|
36669
|
+
async function pairThisMachine() {
|
|
36670
|
+
const host = hostname().replace(/\.local$/, "");
|
|
36671
|
+
const code = await requestCode(host, void 0, host);
|
|
36672
|
+
const link = code.verification_uri_complete;
|
|
36673
|
+
console.log(await import_qrcode.default.toString(link, { type: "terminal", small: true }));
|
|
36674
|
+
printConnectLines(link, code.user_code, !!process.stdin.isTTY);
|
|
36675
|
+
const opener = process.platform === "darwin" ? "open" : "xdg-open";
|
|
36676
|
+
const stop2 = onEnter(process.stdin, () => execFile2(opener, [link], () => {
|
|
36677
|
+
}));
|
|
36678
|
+
try {
|
|
36679
|
+
const deadline = Date.now() + code.expires_in * 1e3;
|
|
36680
|
+
while (Date.now() < deadline) {
|
|
36681
|
+
const token = await pollToken(code.device_code).catch(() => null);
|
|
36682
|
+
if (token) {
|
|
36683
|
+
saveToken(token, "Desktop");
|
|
36684
|
+
return token.name;
|
|
36685
|
+
}
|
|
36686
|
+
await sleep(code.interval * 1e3);
|
|
36687
|
+
}
|
|
36688
|
+
return null;
|
|
36689
|
+
} finally {
|
|
36690
|
+
stop2();
|
|
36691
|
+
}
|
|
36692
|
+
}
|
|
36946
36693
|
function forwardCodexThreadId() {
|
|
36947
36694
|
const cfg = join6(process.env.CODEX_HOME || join6(homedir7(), ".codex"), "config.toml");
|
|
36948
36695
|
if (!existsSync5(cfg)) return;
|
|
@@ -37030,23 +36777,12 @@ async function main() {
|
|
|
37030
36777
|
const live = held ? await credentialWorks(held) : false;
|
|
37031
36778
|
if (held && !live) console.log("\u26A0 this machine was logged out \u2014 reconnecting it now");
|
|
37032
36779
|
if (!live) {
|
|
37033
|
-
const
|
|
37034
|
-
|
|
37035
|
-
printConnectLines(code.verification_uri_complete, code.user_code);
|
|
37036
|
-
const deadline = Date.now() + code.expires_in * 1e3;
|
|
37037
|
-
let paired = false;
|
|
37038
|
-
while (!paired && Date.now() < deadline) {
|
|
37039
|
-
const token = await pollToken(code.device_code).catch(() => null);
|
|
37040
|
-
if (token) {
|
|
37041
|
-
saveToken(token, "Desktop");
|
|
37042
|
-
console.log(`\u2713 paired as "${token.name}"`);
|
|
37043
|
-
paired = true;
|
|
37044
|
-
} else await sleep(code.interval * 1e3);
|
|
37045
|
-
}
|
|
37046
|
-
if (!paired) {
|
|
36780
|
+
const name = await pairThisMachine();
|
|
36781
|
+
if (name === null) {
|
|
37047
36782
|
console.error("Pairing code expired \u2014 run `paigy-harness setup` again.");
|
|
37048
36783
|
process.exit(1);
|
|
37049
36784
|
}
|
|
36785
|
+
console.log(`\u2713 paired as "${name}"`);
|
|
37050
36786
|
} else console.log("\u2713 already paired as this machine");
|
|
37051
36787
|
for (const a of detected) {
|
|
37052
36788
|
if (a.status === "adapter-missing" && a.install) continue;
|
|
@@ -37127,22 +36863,14 @@ async function main() {
|
|
|
37127
36863
|
return;
|
|
37128
36864
|
}
|
|
37129
36865
|
if (existing) console.log("\u26A0 this machine was logged out \u2014 reconnecting it now");
|
|
37130
|
-
const
|
|
37131
|
-
|
|
37132
|
-
|
|
37133
|
-
|
|
37134
|
-
while (Date.now() < deadline) {
|
|
37135
|
-
const token = await pollToken(code.device_code).catch(() => null);
|
|
37136
|
-
if (token) {
|
|
37137
|
-
saveToken(token, "Desktop");
|
|
37138
|
-
console.log(`\u2713 paired as "${token.name}" \u2014 this machine is now launchable from your phone`);
|
|
37139
|
-
console.log(" next: paigy-harness host --grant ~/your/projects (or: paigy-harness service)");
|
|
37140
|
-
return;
|
|
37141
|
-
}
|
|
37142
|
-
await sleep(code.interval * 1e3);
|
|
36866
|
+
const name = await pairThisMachine();
|
|
36867
|
+
if (name === null) {
|
|
36868
|
+
console.error("Pairing code expired \u2014 run `paigy-harness pair` again.");
|
|
36869
|
+
process.exit(1);
|
|
37143
36870
|
}
|
|
37144
|
-
console.
|
|
37145
|
-
|
|
36871
|
+
console.log(`\u2713 paired as "${name}" \u2014 this machine is now launchable from your phone`);
|
|
36872
|
+
console.log(" next: paigy-harness host --grant ~/your/projects (or: paigy-harness service)");
|
|
36873
|
+
return;
|
|
37146
36874
|
}
|
|
37147
36875
|
if (parsed.service) {
|
|
37148
36876
|
if (process.platform !== "darwin") {
|
|
@@ -37314,10 +37042,11 @@ async function main() {
|
|
|
37314
37042
|
void main();
|
|
37315
37043
|
async function credentialWorks(token) {
|
|
37316
37044
|
try {
|
|
37317
|
-
const res = await fetch(`${process.env.PAIGY_API_URL ?? "https://paigy.ai"}/api/
|
|
37045
|
+
const res = await fetch(`${process.env.PAIGY_API_URL ?? "https://paigy.ai"}/api/presence`, {
|
|
37046
|
+
method: "POST",
|
|
37318
37047
|
headers: { authorization: `Bearer ${token}` }
|
|
37319
37048
|
});
|
|
37320
|
-
return res.
|
|
37049
|
+
return res.status !== 401 && res.status !== 403;
|
|
37321
37050
|
} catch {
|
|
37322
37051
|
return true;
|
|
37323
37052
|
}
|