@pome-sh/cli 0.23.14 → 0.23.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/dist/build-info.json +3 -3
- package/dist/{checks-CRT2VDNJ.js → checks-Z4D3ZWPR.js} +1 -1
- package/dist/{chunk-LIU7WE6S.js → chunk-AL3OBU3E.js} +3 -3
- package/dist/{chunk-2QCITOSZ.js → chunk-I5RLCRSF.js} +1 -1
- package/dist/{chunk-YOTVS3WV.js → chunk-JFFQFGUY.js} +1 -1
- package/dist/{chunk-55GQPSNU.js → chunk-NSTOWFWZ.js} +1 -1
- package/dist/{chunk-QN65HV4S.js → chunk-YVIQOQBE.js} +2 -2
- package/dist/{runDemo-5M6UZ63N.js → runDemo-Z2JF74A2.js} +4 -4
- package/dist/{runTrialGroup-DRMURVDS.js → runTrialGroup-TDAV5NPA.js} +3 -3
- package/dist/src/cli/main.js +11 -11
- package/dist/{src-WZSM2RYX.js → src-RZFD2GWN.js} +161 -7
- package/dist/twinHarness-CXIM3PH5.js +5 -0
- package/dist/{twinStart-UFOABD4N.js → twinStart-FMKGM25H.js} +2 -2
- package/package.json +1 -1
- package/dist/twinHarness-7DY2UT3E.js +0 -5
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "pome-sh",
|
|
3
|
-
"version": "0.23.
|
|
4
|
-
"git_sha": "
|
|
5
|
-
"build_time": "2026-08-
|
|
3
|
+
"version": "0.23.15",
|
|
4
|
+
"git_sha": "3e41e4733ed78e2ff9fe899c4b9f88eade15ba0e",
|
|
5
|
+
"build_time": "2026-08-11T20:31:28.241Z"
|
|
6
6
|
}
|
|
@@ -183,7 +183,7 @@ async function checkTwinReachable(_configDir) {
|
|
|
183
183
|
});
|
|
184
184
|
let harness;
|
|
185
185
|
try {
|
|
186
|
-
const { bootTwin } = await import('./twinHarness-
|
|
186
|
+
const { bootTwin } = await import('./twinHarness-CXIM3PH5.js');
|
|
187
187
|
harness = await bootTwin({
|
|
188
188
|
twin: "github",
|
|
189
189
|
seedState: void 0,
|
|
@@ -16,7 +16,7 @@ var package_default4 = {
|
|
|
16
16
|
|
|
17
17
|
// ../packages/twin-linear/package.json
|
|
18
18
|
var package_default5 = {
|
|
19
|
-
version: "0.4.
|
|
19
|
+
version: "0.4.1"};
|
|
20
20
|
|
|
21
21
|
// src/twin/registry.ts
|
|
22
22
|
var TWIN_NAME_LIST = ["github", "slack", "stripe", "gmail", "linear"];
|
|
@@ -149,7 +149,7 @@ var TWIN_REGISTRY = {
|
|
|
149
149
|
portEnvName: "LINEAR_TWIN_PORT",
|
|
150
150
|
tokenEnvName: "POME_LINEAR_TOKEN",
|
|
151
151
|
version: package_default5.version,
|
|
152
|
-
defaultSeed: async () => (await import('./src-
|
|
152
|
+
defaultSeed: async () => (await import('./src-RZFD2GWN.js')).defaultSeedState(),
|
|
153
153
|
async boot({ seedState, runId, recorder }) {
|
|
154
154
|
const {
|
|
155
155
|
createLinearTwinApp,
|
|
@@ -157,7 +157,7 @@ var TWIN_REGISTRY = {
|
|
|
157
157
|
LinearDomain,
|
|
158
158
|
openLinearTwinDatabase,
|
|
159
159
|
parseSeed
|
|
160
|
-
} = await import('./src-
|
|
160
|
+
} = await import('./src-RZFD2GWN.js');
|
|
161
161
|
const db = openLinearTwinDatabase(":memory:");
|
|
162
162
|
const seed = parseSeed(seedState);
|
|
163
163
|
const domain = new LinearDomain(db);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readManifest, normalizeManifestTwins } from './chunk-ABM3CMQB.js';
|
|
2
|
-
import { createHostedClient, perTwinReturnedByCloud, parseTaskFile, runAgentCommand, writeRunArtifactsCore, toTwinHttpEvent, redactJsonl, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, evaluationCounts } from './chunk-
|
|
2
|
+
import { createHostedClient, perTwinReturnedByCloud, parseTaskFile, runAgentCommand, writeRunArtifactsCore, toTwinHttpEvent, redactJsonl, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, evaluationCounts } from './chunk-JFFQFGUY.js';
|
|
3
3
|
import { MOUNTED_TWINS, HostedAuthError, HostedDiscardRefusedError, HostedQuotaError, HostedOrchError, HostedTrialError, agentResponseSchema } from './chunk-X66JOOO7.js';
|
|
4
4
|
import { redactSecrets, redactEvent } from './chunk-SG6ZTIMT.js';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
@@ -2,7 +2,7 @@ import { criterionSchema, finalizeResponseSchema, HostedDiscardRefusedError, Hos
|
|
|
2
2
|
import { seedSchema, parseSeed, defaultSeedState as defaultSeedState$2 } from './chunk-KIUIKAVU.js';
|
|
3
3
|
import { gmailSeedSchema, defaultSeedState } from './chunk-NJ246QPJ.js';
|
|
4
4
|
import { linearSeedSchema, defaultSeedState as defaultSeedState$1 } from './chunk-ZKID2HS3.js';
|
|
5
|
-
import { isTwinName, TWIN_REGISTRY } from './chunk-
|
|
5
|
+
import { isTwinName, TWIN_REGISTRY } from './chunk-AL3OBU3E.js';
|
|
6
6
|
import { toTwinHttpEventRow } from './chunk-TV5S6WQV.js';
|
|
7
7
|
import { redactEvent, redactSecrets } from './chunk-SG6ZTIMT.js';
|
|
8
8
|
import { mkdir, appendFile, writeFile, readFile } from 'node:fs/promises';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TWIN_NAMES, isTwinName, TWIN_REGISTRY } from './chunk-
|
|
1
|
+
import { TWIN_NAMES, isTwinName, TWIN_REGISTRY } from './chunk-AL3OBU3E.js';
|
|
2
2
|
import { createFileBackedRecorderStore, createRecorderStore } from './chunk-TV5S6WQV.js';
|
|
3
3
|
|
|
4
4
|
// src/recorder/recorder.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAvailablePort } from './chunk-XDU6TD4O.js';
|
|
2
2
|
import { buildEgressAllowlist, readBlockedEgress } from './chunk-CBFKZZBR.js';
|
|
3
|
-
import { parseTaskFile, seedStateForTwin, runAgentCommand, writeRunArtifactsCore } from './chunk-
|
|
4
|
-
import { createRecorder, bootTwin } from './chunk-
|
|
3
|
+
import { parseTaskFile, seedStateForTwin, runAgentCommand, writeRunArtifactsCore } from './chunk-JFFQFGUY.js';
|
|
4
|
+
import { createRecorder, bootTwin } from './chunk-NSTOWFWZ.js';
|
|
5
5
|
import { eventSchema } from './chunk-VBATFCWR.js';
|
|
6
6
|
import { redactSecrets, redactEvent } from './chunk-SG6ZTIMT.js';
|
|
7
7
|
import { serve } from '@hono/node-server';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { newGroupId, reassuranceBox, twinReadyLine, trialsHeaderLine, trialLine, summaryLines, evaluatingLine, criterionPhrase } from './chunk-RGZBC7NF.js';
|
|
2
2
|
import { DemoCapacityError, capacityLabel, parseCapacityMarker, capacityKindFrom } from './chunk-ZX4WNSZ5.js';
|
|
3
|
-
import { runTask, demoTaskPath, DEMO_TASK_NAME, DEMO_REPO } from './chunk-
|
|
3
|
+
import { runTask, demoTaskPath, DEMO_TASK_NAME, DEMO_REPO } from './chunk-YVIQOQBE.js';
|
|
4
4
|
import { getAvailablePort } from './chunk-XDU6TD4O.js';
|
|
5
5
|
import './chunk-CBFKZZBR.js';
|
|
6
|
-
import { createHostedClient, parseTaskFile, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, outcomeOf } from './chunk-
|
|
6
|
+
import { createHostedClient, parseTaskFile, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, outcomeOf } from './chunk-JFFQFGUY.js';
|
|
7
7
|
import './chunk-NW7HGA2K.js';
|
|
8
8
|
import { HostedQuotaError, HostedOrchError } from './chunk-X66JOOO7.js';
|
|
9
9
|
import './chunk-KIUIKAVU.js';
|
|
10
10
|
import './chunk-NJ246QPJ.js';
|
|
11
11
|
import './chunk-ZKID2HS3.js';
|
|
12
|
-
import { bootTwin } from './chunk-
|
|
13
|
-
import './chunk-
|
|
12
|
+
import { bootTwin } from './chunk-NSTOWFWZ.js';
|
|
13
|
+
import './chunk-AL3OBU3E.js';
|
|
14
14
|
import './chunk-TV5S6WQV.js';
|
|
15
15
|
import './chunk-VBATFCWR.js';
|
|
16
16
|
import './chunk-SG6ZTIMT.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { newGroupId, criterionPhrase } from './chunk-RGZBC7NF.js';
|
|
2
|
-
import { runTaskHosted, resolveRunAgentIdentity } from './chunk-
|
|
2
|
+
import { runTaskHosted, resolveRunAgentIdentity } from './chunk-I5RLCRSF.js';
|
|
3
3
|
import './chunk-ABM3CMQB.js';
|
|
4
|
-
import { createHostedClient, parseTaskFile, outcomeOf } from './chunk-
|
|
4
|
+
import { createHostedClient, parseTaskFile, outcomeOf } from './chunk-JFFQFGUY.js';
|
|
5
5
|
import './chunk-NW7HGA2K.js';
|
|
6
6
|
import { HostedQuotaError, HostedTrialError } from './chunk-X66JOOO7.js';
|
|
7
7
|
import './chunk-KIUIKAVU.js';
|
|
8
8
|
import './chunk-NJ246QPJ.js';
|
|
9
9
|
import './chunk-ZKID2HS3.js';
|
|
10
|
-
import './chunk-
|
|
10
|
+
import './chunk-AL3OBU3E.js';
|
|
11
11
|
import './chunk-TV5S6WQV.js';
|
|
12
12
|
import './chunk-VBATFCWR.js';
|
|
13
13
|
import './chunk-SG6ZTIMT.js';
|
package/dist/src/cli/main.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { DEFAULT_CONTROL_PLANE_URL, DEFAULT_DASHBOARD_URL, clearLocalCredentials, friendlyHostedError, runSessionCreate, runSessionList, runSessionStop, resolveCredentials, runTaskHosted, discoverRunSet, VERDICT_ARTIFACT_VERSION, persistCredentialsAfterLogin, DEFAULT_DOCS_SITE_ORIGIN, resolveSeams, resolveCachedAgentId, readLinkCache, postAgentResolver, writeLinkCache, ensurePomeGitignored } from '../../chunk-
|
|
2
|
+
import { DEFAULT_CONTROL_PLANE_URL, DEFAULT_DASHBOARD_URL, clearLocalCredentials, friendlyHostedError, runSessionCreate, runSessionList, runSessionStop, resolveCredentials, runTaskHosted, discoverRunSet, VERDICT_ARTIFACT_VERSION, persistCredentialsAfterLogin, DEFAULT_DOCS_SITE_ORIGIN, resolveSeams, resolveCachedAgentId, readLinkCache, postAgentResolver, writeLinkCache, ensurePomeGitignored } from '../../chunk-I5RLCRSF.js';
|
|
3
3
|
import { readManifest, writeManifest, MANIFEST_JSON, readRequiredManifest, normalizeManifestTwins } from '../../chunk-ABM3CMQB.js';
|
|
4
|
-
import { assetPath, runTask, resolvePackageRoot, DEMO_TASK_NAME, demoTaskPath } from '../../chunk-
|
|
4
|
+
import { assetPath, runTask, resolvePackageRoot, DEMO_TASK_NAME, demoTaskPath } from '../../chunk-YVIQOQBE.js';
|
|
5
5
|
import '../../chunk-XDU6TD4O.js';
|
|
6
6
|
import '../../chunk-CBFKZZBR.js';
|
|
7
|
-
import { parseTaskFile, scoreStatus, runScoreLine, readLatestRun, readMetaSummary, outcomeOf, readConfigTwins, scoreCountsSummary, markerFor, criterionMarkerLabel, twinSkipSuffix, readCodeCriteria, createHostedClient, toTwinHttpEvent, redactJsonl, scoreFromFinalizeResponse, parseGitHubSeedState, uploadRunBlobs, isPreSatisfied } from '../../chunk-
|
|
7
|
+
import { parseTaskFile, scoreStatus, runScoreLine, readLatestRun, readMetaSummary, outcomeOf, readConfigTwins, scoreCountsSummary, markerFor, criterionMarkerLabel, twinSkipSuffix, readCodeCriteria, createHostedClient, toTwinHttpEvent, redactJsonl, scoreFromFinalizeResponse, parseGitHubSeedState, uploadRunBlobs, isPreSatisfied } from '../../chunk-JFFQFGUY.js';
|
|
8
8
|
import '../../chunk-NW7HGA2K.js';
|
|
9
9
|
import { MOUNTED_TWINS, deriveAgentSlug, exitCodeFor, HostedUsageError, HostedOrchError, HostedAuthError, HostedQuotaError } from '../../chunk-X66JOOO7.js';
|
|
10
10
|
import { TAPE_ASSERTABLE_TOOLS } from '../../chunk-FKZZWWYC.js';
|
|
@@ -15,8 +15,8 @@ import '../../chunk-NJ246QPJ.js';
|
|
|
15
15
|
import { LINEAR_CHECKS } from '../../chunk-XBT6ZLBG.js';
|
|
16
16
|
import '../../chunk-ZKID2HS3.js';
|
|
17
17
|
import { oneOf, defineCheck, repoRef, VACUITY_SENTINEL_NUMBER, childStatePath, VACUITY_SENTINEL, statePath, templateSlots, renderCheck, checksDigest, checkPattern, checkNearMissPattern } from '../../chunk-JWJYNAWI.js';
|
|
18
|
-
import '../../chunk-
|
|
19
|
-
import { TWIN_NAME_LIST, isTwinName, createGitHubSmokeApp } from '../../chunk-
|
|
18
|
+
import '../../chunk-NSTOWFWZ.js';
|
|
19
|
+
import { TWIN_NAME_LIST, isTwinName, createGitHubSmokeApp } from '../../chunk-AL3OBU3E.js';
|
|
20
20
|
import '../../chunk-TV5S6WQV.js';
|
|
21
21
|
import { isLegacyEventRow, eventSchema } from '../../chunk-VBATFCWR.js';
|
|
22
22
|
import { redactEvent, redactSecrets } from '../../chunk-SG6ZTIMT.js';
|
|
@@ -4541,7 +4541,7 @@ var DEFAULT_AGENT_COMMAND = `node ${DEFAULT_AGENT_FILE}`;
|
|
|
4541
4541
|
var MANIFEST_SCHEMA_URL = "https://pome.sh/schemas/v1/pome.json";
|
|
4542
4542
|
var MAX_UNREADABLE_PATHS_SHOWN = 5;
|
|
4543
4543
|
function readPackageVersion() {
|
|
4544
|
-
if ("0.23.
|
|
4544
|
+
if ("0.23.15".length > 0) return "0.23.15";
|
|
4545
4545
|
try {
|
|
4546
4546
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
4547
4547
|
const candidates = [
|
|
@@ -4996,7 +4996,7 @@ function createProgram() {
|
|
|
4996
4996
|
return;
|
|
4997
4997
|
}
|
|
4998
4998
|
{
|
|
4999
|
-
const { runDoctorChecks } = await import('../../checks-
|
|
4999
|
+
const { runDoctorChecks } = await import('../../checks-Z4D3ZWPR.js');
|
|
5000
5000
|
const { renderDoctorReport } = await import('../../render-ZQQ4UMNO.js');
|
|
5001
5001
|
const doctorReport = await runDoctorChecks({ mode: useLocal ? "full" : "hosted" });
|
|
5002
5002
|
if (!doctorReport.ok) {
|
|
@@ -5034,7 +5034,7 @@ function createProgram() {
|
|
|
5034
5034
|
taskForRuns.config.runs
|
|
5035
5035
|
);
|
|
5036
5036
|
if (k > 1) {
|
|
5037
|
-
const { runTrialGroup } = await import('../../runTrialGroup-
|
|
5037
|
+
const { runTrialGroup } = await import('../../runTrialGroup-TDAV5NPA.js');
|
|
5038
5038
|
const fileForRerun = relative(process.cwd(), file);
|
|
5039
5039
|
const rerunCommand = defaultTask ? options.trials !== void 0 ? `pome run -n ${k}` : "pome run" : `pome run ${fileForRerun && !fileForRerun.startsWith("..") ? fileForRerun : file} -n ${k}`;
|
|
5040
5040
|
const groupResult = await runTrialGroup({
|
|
@@ -5128,7 +5128,7 @@ function createProgram() {
|
|
|
5128
5128
|
process.exitCode = 5;
|
|
5129
5129
|
return;
|
|
5130
5130
|
}
|
|
5131
|
-
const { runDemo } = await import('../../runDemo-
|
|
5131
|
+
const { runDemo } = await import('../../runDemo-Z2JF74A2.js');
|
|
5132
5132
|
const result = await runDemo({
|
|
5133
5133
|
apiBase: opts.apiUrl.replace(/\/$/, ""),
|
|
5134
5134
|
dashboardBase: process.env.POME_DASHBOARD_URL ?? DEFAULT_DASHBOARD_URL,
|
|
@@ -5146,7 +5146,7 @@ function createProgram() {
|
|
|
5146
5146
|
program.command("doctor").description(
|
|
5147
5147
|
"Check the agent\u2194twin wiring: pome.json (or pome.yaml) present + valid, the local twin boots + serves, requests routed to the twin (not a hardcoded production host), egress floor active. On failure prints one named cause (file:line where knowable) + one concrete fix and exits non-zero."
|
|
5148
5148
|
).action(async () => {
|
|
5149
|
-
const { runDoctorChecks } = await import('../../checks-
|
|
5149
|
+
const { runDoctorChecks } = await import('../../checks-Z4D3ZWPR.js');
|
|
5150
5150
|
const { renderDoctorReport } = await import('../../render-ZQQ4UMNO.js');
|
|
5151
5151
|
const report = await runDoctorChecks();
|
|
5152
5152
|
for (const line of renderDoctorReport(report, { passNote: true })) console.error(line);
|
|
@@ -5322,7 +5322,7 @@ function createProgram() {
|
|
|
5322
5322
|
).description(
|
|
5323
5323
|
"Start a standalone twin as a long-lived foreground server (Ctrl-C to stop)"
|
|
5324
5324
|
).action(async (name, options) => {
|
|
5325
|
-
const { runTwinStartCommand } = await import('../../twinStart-
|
|
5325
|
+
const { runTwinStartCommand } = await import('../../twinStart-FMKGM25H.js');
|
|
5326
5326
|
await runTwinStartCommand(name, options);
|
|
5327
5327
|
});
|
|
5328
5328
|
twin.command("reset").argument("[name]", "Twin name (default: github)", "github").description("Reset standalone twin state").action(async (name) => {
|
|
@@ -11,6 +11,7 @@ import { z } from 'zod';
|
|
|
11
11
|
import { isIP } from 'node:net';
|
|
12
12
|
import { lookup } from 'node:dns/promises';
|
|
13
13
|
import { Hono } from 'hono';
|
|
14
|
+
import { HonoRequest } from 'hono/request';
|
|
14
15
|
import { buildSchema, graphql, parse, getOperationAST } from 'graphql';
|
|
15
16
|
|
|
16
17
|
// ../packages/twin-linear/dist/src/db.js
|
|
@@ -3409,9 +3410,124 @@ function shouldRedact(key) {
|
|
|
3409
3410
|
return true;
|
|
3410
3411
|
return false;
|
|
3411
3412
|
}
|
|
3413
|
+
var UNSATISFIABLE = {
|
|
3414
|
+
status: 400,
|
|
3415
|
+
body: {
|
|
3416
|
+
errors: [
|
|
3417
|
+
{
|
|
3418
|
+
message: "Internal server error",
|
|
3419
|
+
extensions: {
|
|
3420
|
+
http: { status: 400, headers: {} },
|
|
3421
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
3422
|
+
type: "internal error",
|
|
3423
|
+
userError: false
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
]
|
|
3427
|
+
}
|
|
3428
|
+
};
|
|
3429
|
+
var NOT_FOUND = {
|
|
3430
|
+
status: 200,
|
|
3431
|
+
body: {
|
|
3432
|
+
errors: [
|
|
3433
|
+
{
|
|
3434
|
+
message: "PersistedQueryNotFound",
|
|
3435
|
+
extensions: {
|
|
3436
|
+
http: { status: 200, headers: {} },
|
|
3437
|
+
code: "PERSISTED_QUERY_NOT_FOUND",
|
|
3438
|
+
type: "graphql error",
|
|
3439
|
+
userError: true
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
]
|
|
3443
|
+
}
|
|
3444
|
+
};
|
|
3445
|
+
function badRequest(message) {
|
|
3446
|
+
return {
|
|
3447
|
+
status: 400,
|
|
3448
|
+
body: {
|
|
3449
|
+
errors: [
|
|
3450
|
+
{
|
|
3451
|
+
message,
|
|
3452
|
+
extensions: {
|
|
3453
|
+
http: { status: 400, headers: {} },
|
|
3454
|
+
code: "BAD_REQUEST",
|
|
3455
|
+
type: "internal error",
|
|
3456
|
+
userError: false
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
]
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
}
|
|
3463
|
+
function checkPersistedQuery(envelope) {
|
|
3464
|
+
const decoded = decodeExtensions(envelope.extensions, envelope.location);
|
|
3465
|
+
if (decoded.kind === "answer")
|
|
3466
|
+
return decoded.answer;
|
|
3467
|
+
if (decoded.value === null)
|
|
3468
|
+
return null;
|
|
3469
|
+
const descriptor = decoded.value.persistedQuery;
|
|
3470
|
+
if (descriptor === void 0 || descriptor === null)
|
|
3471
|
+
return null;
|
|
3472
|
+
if (!isRecord(descriptor))
|
|
3473
|
+
return UNSATISFIABLE;
|
|
3474
|
+
const { version, sha256Hash } = descriptor;
|
|
3475
|
+
if (version !== 1 || typeof sha256Hash !== "string")
|
|
3476
|
+
return UNSATISFIABLE;
|
|
3477
|
+
if (!envelope.query)
|
|
3478
|
+
return NOT_FOUND;
|
|
3479
|
+
return sha256Hash === sha256Hex(envelope.query) ? null : UNSATISFIABLE;
|
|
3480
|
+
}
|
|
3481
|
+
function decodeExtensions(raw, location) {
|
|
3482
|
+
if (raw === void 0)
|
|
3483
|
+
return { kind: "value", value: null };
|
|
3484
|
+
if (location === "query") {
|
|
3485
|
+
if (typeof raw !== "string")
|
|
3486
|
+
return { kind: "value", value: null };
|
|
3487
|
+
let parsed;
|
|
3488
|
+
try {
|
|
3489
|
+
parsed = JSON.parse(raw);
|
|
3490
|
+
} catch {
|
|
3491
|
+
return {
|
|
3492
|
+
kind: "answer",
|
|
3493
|
+
answer: badRequest("The extensions search parameter contains invalid JSON.")
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
if (!isRecord(parsed)) {
|
|
3497
|
+
return {
|
|
3498
|
+
kind: "answer",
|
|
3499
|
+
answer: badRequest("The extensions search parameter should contain a JSON-encoded object.")
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
return { kind: "value", value: parsed };
|
|
3503
|
+
}
|
|
3504
|
+
if (raw === null)
|
|
3505
|
+
return { kind: "value", value: null };
|
|
3506
|
+
if (typeof raw === "string") {
|
|
3507
|
+
return {
|
|
3508
|
+
kind: "answer",
|
|
3509
|
+
answer: badRequest("`extensions` in a POST body should be provided as an object, not a recursively JSON-encoded string.")
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
if (!isRecord(raw)) {
|
|
3513
|
+
return {
|
|
3514
|
+
kind: "answer",
|
|
3515
|
+
answer: badRequest("`extensions` in a POST body must be an object if provided.")
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
3518
|
+
return { kind: "value", value: raw };
|
|
3519
|
+
}
|
|
3520
|
+
function sha256Hex(query) {
|
|
3521
|
+
return createHash("sha256").update(query).digest("hex");
|
|
3522
|
+
}
|
|
3523
|
+
function isRecord(value) {
|
|
3524
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3525
|
+
}
|
|
3412
3526
|
var declareInputs = routeInputDeclarer("ignore");
|
|
3413
3527
|
var VARIABLES_STRING = z.string().optional();
|
|
3414
3528
|
var VARIABLES_OBJECT = z.union([z.record(z.string(), z.unknown()), z.string()]).optional();
|
|
3529
|
+
var EXTENSIONS_STRING = z.string().optional();
|
|
3530
|
+
var EXTENSIONS_ANY = z.unknown().optional();
|
|
3415
3531
|
var AUTHORIZE_PARAMS = {
|
|
3416
3532
|
client_id: z.string().optional(),
|
|
3417
3533
|
redirect_uri: z.string().optional(),
|
|
@@ -3428,7 +3544,8 @@ var LINEAR_ROUTES = {
|
|
|
3428
3544
|
query: {
|
|
3429
3545
|
query: z.string().optional(),
|
|
3430
3546
|
variables: VARIABLES_STRING,
|
|
3431
|
-
operationName: z.string().optional()
|
|
3547
|
+
operationName: z.string().optional(),
|
|
3548
|
+
extensions: EXTENSIONS_STRING
|
|
3432
3549
|
}
|
|
3433
3550
|
}),
|
|
3434
3551
|
graphqlPost: declareInputs({
|
|
@@ -3438,7 +3555,8 @@ var LINEAR_ROUTES = {
|
|
|
3438
3555
|
body: {
|
|
3439
3556
|
query: z.string().optional(),
|
|
3440
3557
|
variables: VARIABLES_OBJECT,
|
|
3441
|
-
operationName: z.string().optional()
|
|
3558
|
+
operationName: z.string().optional(),
|
|
3559
|
+
extensions: EXTENSIONS_ANY
|
|
3442
3560
|
}
|
|
3443
3561
|
}),
|
|
3444
3562
|
oauthAuthorize: declareInputs({
|
|
@@ -3484,8 +3602,6 @@ var LINEAR_ROUTES = {
|
|
|
3484
3602
|
}
|
|
3485
3603
|
})
|
|
3486
3604
|
};
|
|
3487
|
-
|
|
3488
|
-
// ../packages/twin-linear/dist/src/oauth/routes.js
|
|
3489
3605
|
async function parseDeclared(declaration, c, onUndeclared) {
|
|
3490
3606
|
try {
|
|
3491
3607
|
return { input: await declaration.parse(c.req) };
|
|
@@ -5221,12 +5337,12 @@ function parseVariables(raw) {
|
|
|
5221
5337
|
return void 0;
|
|
5222
5338
|
try {
|
|
5223
5339
|
const parsed = JSON.parse(raw);
|
|
5224
|
-
return
|
|
5340
|
+
return isRecord2(parsed) ? parsed : void 0;
|
|
5225
5341
|
} catch {
|
|
5226
5342
|
return void 0;
|
|
5227
5343
|
}
|
|
5228
5344
|
}
|
|
5229
|
-
function
|
|
5345
|
+
function isRecord2(value) {
|
|
5230
5346
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
5231
5347
|
}
|
|
5232
5348
|
function assertSelectionDepth(query, max) {
|
|
@@ -5320,6 +5436,44 @@ function withPublicOAuth(app, db) {
|
|
|
5320
5436
|
root.route("/", app);
|
|
5321
5437
|
return root;
|
|
5322
5438
|
}
|
|
5439
|
+
function withPersistedQueryGate(app) {
|
|
5440
|
+
const root = new Hono();
|
|
5441
|
+
const path = LINEAR_ROUTES.graphqlPost.path;
|
|
5442
|
+
for (const mount of [path, `/s/:sid${path}`]) {
|
|
5443
|
+
root.use(mount, async (c, next) => {
|
|
5444
|
+
const answer = await persistedQueryAnswer(c);
|
|
5445
|
+
if (!answer)
|
|
5446
|
+
return next();
|
|
5447
|
+
return c.json(answer.body, answer.status);
|
|
5448
|
+
});
|
|
5449
|
+
}
|
|
5450
|
+
root.route("/", app);
|
|
5451
|
+
return root;
|
|
5452
|
+
}
|
|
5453
|
+
async function persistedQueryAnswer(c) {
|
|
5454
|
+
try {
|
|
5455
|
+
if (c.req.method === "GET") {
|
|
5456
|
+
const { query } = await LINEAR_ROUTES.graphqlGet.parse(c.req);
|
|
5457
|
+
return checkPersistedQuery({
|
|
5458
|
+
query: query.query,
|
|
5459
|
+
extensions: query.extensions,
|
|
5460
|
+
location: "query"
|
|
5461
|
+
});
|
|
5462
|
+
}
|
|
5463
|
+
if (c.req.method === "POST") {
|
|
5464
|
+
const peek = new HonoRequest(c.req.raw.clone());
|
|
5465
|
+
const { body } = await LINEAR_ROUTES.graphqlPost.parse(peek);
|
|
5466
|
+
return checkPersistedQuery({
|
|
5467
|
+
query: body.query,
|
|
5468
|
+
extensions: body.extensions,
|
|
5469
|
+
location: "body"
|
|
5470
|
+
});
|
|
5471
|
+
}
|
|
5472
|
+
return null;
|
|
5473
|
+
} catch {
|
|
5474
|
+
return null;
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5323
5477
|
function createLinearTwinApp(options = {}) {
|
|
5324
5478
|
const db = options.db ?? openLinearTwinDatabase(":memory:");
|
|
5325
5479
|
const definition = createLinearTwinDefinition(db);
|
|
@@ -5330,7 +5484,7 @@ function createLinearTwinApp(options = {}) {
|
|
|
5330
5484
|
runId: options.runId ?? "spawn",
|
|
5331
5485
|
seed
|
|
5332
5486
|
});
|
|
5333
|
-
return withPublicOAuth(app, db);
|
|
5487
|
+
return withPersistedQueryGate(withPublicOAuth(app, db));
|
|
5334
5488
|
}
|
|
5335
5489
|
|
|
5336
5490
|
export { LINEAR_MCP_TOOL_COUNT, LinearDomain, createLinearTwinApp, createLinearTwinDefinition, exportLinearState, linearStateDelta, linearToolFixture, linearTools, looksLikeLinearToken, migrate, openLinearTwinDatabase, projectLinearRecording, registerLinearRoutes, resetDatabase, resolveLinearCredential, withPublicOAuth };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bootTwin } from './chunk-
|
|
2
|
-
import { isTwinName, TWIN_NAMES, defaultPortFor, TWIN_REGISTRY } from './chunk-
|
|
1
|
+
import { bootTwin } from './chunk-NSTOWFWZ.js';
|
|
2
|
+
import { isTwinName, TWIN_NAMES, defaultPortFor, TWIN_REGISTRY } from './chunk-AL3OBU3E.js';
|
|
3
3
|
import './chunk-TV5S6WQV.js';
|
|
4
4
|
import './chunk-VBATFCWR.js';
|
|
5
5
|
import './chunk-SG6ZTIMT.js';
|
package/package.json
CHANGED