@portel/photon 1.27.0 → 1.28.1

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.
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Augments `this.sample()` calls with three composable behaviors:
3
+ *
4
+ * 1. Memory include convention — keys prefixed `include_system_` auto-inject
5
+ * into systemPrompt; `include_transient_` inject as a trailing context
6
+ * message appended to the messages array.
7
+ *
8
+ * Note: the FileMemoryBackend sanitizes key names (replaces [^a-zA-Z0-9_.-]
9
+ * with '_'), so colons are not safe in key names. Underscore separators
10
+ * are used throughout to guarantee the stored filenames and prefix filters
11
+ * always agree.
12
+ *
13
+ * 2. Transient context registry (ContextRegistry) — in-memory named sections
14
+ * with high/medium/low priority. Assembled into the trailing message
15
+ * alongside memory transient includes. Low-priority sections are dropped
16
+ * first under budget pressure.
17
+ *
18
+ * 3. Repeat-loop detection (RepeatDetector) — tracks the last 8 responses.
19
+ * On consecutive duplicates, injects a graded signal into the next call's
20
+ * systemPrompt so the model sees loop pressure as inline feedback.
21
+ *
22
+ * All three compose inside assembleSampleParams(), which is called by
23
+ * the augmented this.sample() in loader.ts before forwarding to samplingProvider.
24
+ */
25
+ export type ContextPriority = 'high' | 'medium' | 'low';
26
+ export declare class ContextRegistry {
27
+ private _sections;
28
+ add(name: string, content: string, priority?: ContextPriority): void;
29
+ clear(name: string): void;
30
+ clearAll(): void;
31
+ /**
32
+ * Assemble all sections into a single text block within `budget` chars.
33
+ * Sections are sorted by priority descending (high kept longest).
34
+ * Whole sections are dropped — never truncated mid-content.
35
+ * Returns '' when empty or when all sections exceed the budget.
36
+ */
37
+ assemble(budget?: number): string;
38
+ }
39
+ export declare class RepeatDetector {
40
+ private _history;
41
+ private _streak;
42
+ private _pendingSignal;
43
+ /**
44
+ * Record a response after samplingProvider returns.
45
+ * Updates the pending signal for injection on the next call.
46
+ */
47
+ record(response: string): void;
48
+ /** Read the pending signal to inject at the start of the next sample() call. */
49
+ consumeSignal(): string | null;
50
+ }
51
+ export interface SampleParams {
52
+ prompt?: string;
53
+ messages?: Array<{
54
+ role: 'user' | 'assistant';
55
+ content: any;
56
+ }>;
57
+ systemPrompt?: string;
58
+ maxTokens?: number;
59
+ temperature?: number;
60
+ modelPreferences?: unknown;
61
+ stopSequences?: string[];
62
+ includeContext?: 'none' | 'thisServer' | 'allServers';
63
+ }
64
+ export interface AugmentedSampleParams {
65
+ messages: Array<{
66
+ role: 'user' | 'assistant';
67
+ content: any;
68
+ }>;
69
+ systemPrompt: string | undefined;
70
+ maxTokens: number;
71
+ temperature: number | undefined;
72
+ modelPreferences: unknown;
73
+ stopSequences: string[] | undefined;
74
+ includeContext: string | undefined;
75
+ }
76
+ /**
77
+ * Assemble the final messages + systemPrompt to pass to samplingProvider.
78
+ *
79
+ * Reads memory includes and the context registry, then composes them with
80
+ * the caller-supplied params. Fail-soft: errors in memory reads or registry
81
+ * assembly are swallowed so a broken memory backend never kills a sample() call.
82
+ */
83
+ export declare function assembleSampleParams(params: SampleParams, memory: any, context: ContextRegistry, repeatSignal: string | null): Promise<AugmentedSampleParams>;
84
+ //# sourceMappingURL=sample-augmenter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sample-augmenter.d.ts","sourceRoot":"","sources":["../src/sample-augmenter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAWxD,qBAAa,eAAe;IAC1B,OAAO,CAAC,SAAS,CAAqC;IAEtD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,eAA0B,GAAG,IAAI;IAI9E,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIzB,QAAQ,IAAI,IAAI;IAIhB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,GAAE,MAAuB,GAAG,MAAM;CAgBlD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O,CAAC,qBAAqB,CAAC,CA0DhC"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Augments `this.sample()` calls with three composable behaviors:
3
+ *
4
+ * 1. Memory include convention — keys prefixed `include_system_` auto-inject
5
+ * into systemPrompt; `include_transient_` inject as a trailing context
6
+ * message appended to the messages array.
7
+ *
8
+ * Note: the FileMemoryBackend sanitizes key names (replaces [^a-zA-Z0-9_.-]
9
+ * with '_'), so colons are not safe in key names. Underscore separators
10
+ * are used throughout to guarantee the stored filenames and prefix filters
11
+ * always agree.
12
+ *
13
+ * 2. Transient context registry (ContextRegistry) — in-memory named sections
14
+ * with high/medium/low priority. Assembled into the trailing message
15
+ * alongside memory transient includes. Low-priority sections are dropped
16
+ * first under budget pressure.
17
+ *
18
+ * 3. Repeat-loop detection (RepeatDetector) — tracks the last 8 responses.
19
+ * On consecutive duplicates, injects a graded signal into the next call's
20
+ * systemPrompt so the model sees loop pressure as inline feedback.
21
+ *
22
+ * All three compose inside assembleSampleParams(), which is called by
23
+ * the augmented this.sample() in loader.ts before forwarding to samplingProvider.
24
+ */
25
+ const PRIORITY_RANK = { high: 2, medium: 1, low: 0 };
26
+ const DEFAULT_BUDGET = 8_000;
27
+ export class ContextRegistry {
28
+ _sections = new Map();
29
+ add(name, content, priority = 'medium') {
30
+ this._sections.set(name, { name, content, priority });
31
+ }
32
+ clear(name) {
33
+ this._sections.delete(name);
34
+ }
35
+ clearAll() {
36
+ this._sections.clear();
37
+ }
38
+ /**
39
+ * Assemble all sections into a single text block within `budget` chars.
40
+ * Sections are sorted by priority descending (high kept longest).
41
+ * Whole sections are dropped — never truncated mid-content.
42
+ * Returns '' when empty or when all sections exceed the budget.
43
+ */
44
+ assemble(budget = DEFAULT_BUDGET) {
45
+ if (this._sections.size === 0)
46
+ return '';
47
+ // Sort descending by priority so dropping from the tail removes low-priority first
48
+ const sorted = [...this._sections.values()].sort((a, b) => PRIORITY_RANK[b.priority] - PRIORITY_RANK[a.priority]);
49
+ let included = sorted;
50
+ while (included.length > 0) {
51
+ const text = included.map((s) => `# ${s.name}\n${s.content}`).join('\n\n');
52
+ if (text.length <= budget)
53
+ return text;
54
+ included = included.slice(0, included.length - 1);
55
+ }
56
+ return '';
57
+ }
58
+ }
59
+ // ─── Repeat Detector ─────────────────────────────────────────────────────────
60
+ const HISTORY_SIZE = 8;
61
+ const MIN_NORMALIZED_LENGTH = 20;
62
+ function normalizeText(text) {
63
+ return text
64
+ .trim()
65
+ .toLowerCase()
66
+ .replace(/[^\w\s]/g, '')
67
+ .replace(/\s+/g, ' ');
68
+ }
69
+ export class RepeatDetector {
70
+ _history = [];
71
+ _streak = 0;
72
+ _pendingSignal = null;
73
+ /**
74
+ * Record a response after samplingProvider returns.
75
+ * Updates the pending signal for injection on the next call.
76
+ */
77
+ record(response) {
78
+ const norm = normalizeText(response);
79
+ if (norm.length < MIN_NORMALIZED_LENGTH)
80
+ return;
81
+ if (this._history.includes(norm)) {
82
+ this._streak++;
83
+ const level = this._streak === 1 ? 'INFO' : this._streak === 2 ? 'WARN' : 'ERROR';
84
+ this._pendingSignal = `[${level}: Response appears to be repeating. Try a different approach.]`;
85
+ }
86
+ else {
87
+ this._streak = 0;
88
+ this._pendingSignal = null;
89
+ }
90
+ this._history.push(norm);
91
+ if (this._history.length > HISTORY_SIZE)
92
+ this._history.shift();
93
+ }
94
+ /** Read the pending signal to inject at the start of the next sample() call. */
95
+ consumeSignal() {
96
+ return this._pendingSignal;
97
+ }
98
+ }
99
+ /**
100
+ * Assemble the final messages + systemPrompt to pass to samplingProvider.
101
+ *
102
+ * Reads memory includes and the context registry, then composes them with
103
+ * the caller-supplied params. Fail-soft: errors in memory reads or registry
104
+ * assembly are swallowed so a broken memory backend never kills a sample() call.
105
+ */
106
+ export async function assembleSampleParams(params, memory, context, repeatSignal) {
107
+ const baseMessages = params.messages ?? [
108
+ { role: 'user', content: { type: 'text', text: params.prompt } },
109
+ ];
110
+ let memorySystemParts = [];
111
+ let memoryTransientParts = [];
112
+ try {
113
+ const [systemEntries, transientEntries] = await Promise.all([
114
+ memory.list('include_system_'),
115
+ memory.list('include_transient_'),
116
+ ]);
117
+ memorySystemParts = systemEntries.map((e) => e.value).filter(Boolean);
118
+ memoryTransientParts = transientEntries.map((e) => e.value).filter(Boolean);
119
+ }
120
+ catch {
121
+ // Fail-soft: leave both arrays empty
122
+ }
123
+ // Build systemPrompt: repeat signal → memory system includes → caller systemPrompt
124
+ const systemParts = [];
125
+ if (repeatSignal)
126
+ systemParts.push(repeatSignal);
127
+ if (memorySystemParts.length)
128
+ systemParts.push(memorySystemParts.join('\n\n'));
129
+ if (params.systemPrompt)
130
+ systemParts.push(params.systemPrompt);
131
+ const systemPrompt = systemParts.length ? systemParts.join('\n\n') : undefined;
132
+ // Build trailing transient message: memory transient includes + context registry
133
+ const transientParts = [];
134
+ if (memoryTransientParts.length)
135
+ transientParts.push(memoryTransientParts.join('\n\n'));
136
+ let contextText = '';
137
+ try {
138
+ contextText = context.assemble();
139
+ }
140
+ catch {
141
+ // Fail-soft
142
+ }
143
+ if (contextText)
144
+ transientParts.push(contextText);
145
+ const messages = transientParts.length > 0
146
+ ? [
147
+ ...baseMessages,
148
+ {
149
+ role: 'user',
150
+ content: { type: 'text', text: transientParts.join('\n\n') },
151
+ },
152
+ ]
153
+ : baseMessages;
154
+ return {
155
+ messages,
156
+ systemPrompt,
157
+ maxTokens: params.maxTokens ?? 1024,
158
+ temperature: params.temperature,
159
+ modelPreferences: params.modelPreferences,
160
+ stopSequences: params.stopSequences,
161
+ includeContext: params.includeContext,
162
+ };
163
+ }
164
+ //# sourceMappingURL=sample-augmenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sample-augmenter.js","sourceRoot":"","sources":["../src/sample-augmenter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAYH,MAAM,aAAa,GAAoC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAA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
4
+ * Both the runtime loader and the Cloudflare deploy code-gen need to know
5
+ * which class methods are bound to HTTP routes. The photon-core
6
+ * `SchemaExtractor` does not return route metadata in every published
7
+ * version, so callers MUST NOT rely on it: this regex-based extractor
8
+ * runs against the raw source and always produces a stable shape.
9
+ *
10
+ * Why a separate module: prior to v1.28.1 the regex lived inside the
11
+ * loader as a private method, so the deploy path silently fell back to
12
+ * `metadata.httpRoutes ?? []` from photon-core. With photon-core 2.25.0,
13
+ * that field is always undefined — every Cloudflare deploy with @get/@post
14
+ * routes (other than `@get /`) shipped an empty subclass route table and
15
+ * 404'd in production. See tests/cf-deploy-codegen.test.ts.
16
+ */
17
+ export interface HttpRouteDef {
18
+ method: string;
19
+ path: string;
20
+ handler: string;
21
+ }
22
+ export declare function extractHttpRoutesFromSource(source: string): HttpRouteDef[];
23
+ //# sourceMappingURL=http-route-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-route-extractor.d.ts","sourceRoot":"","sources":["../../src/shared/http-route-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAQ1E"}
@@ -0,0 +1,11 @@
1
+ const ROUTE_RE = /\/\*\*[\s\S]*?@(get|post)\s+(\/[^\s*]*)[\s\S]*?\*\/\s*(?:async\s+)?(\w+)\s*\(/gi;
2
+ export function extractHttpRoutesFromSource(source) {
3
+ const routes = [];
4
+ ROUTE_RE.lastIndex = 0;
5
+ let m;
6
+ while ((m = ROUTE_RE.exec(source)) !== null) {
7
+ routes.push({ method: m[1].toUpperCase(), path: m[2], handler: m[3] });
8
+ }
9
+ return routes;
10
+ }
11
+ //# sourceMappingURL=http-route-extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-route-extractor.js","sourceRoot":"","sources":["../../src/shared/http-route-extractor.ts"],"names":[],"mappings":"AAsBA,MAAM,QAAQ,GAAG,iFAAiF,CAAC;AAEnG,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,30 @@
1
+ export interface NpmRegistryError extends Error {
2
+ /** HTTP status code if the failure was at the response layer. */
3
+ statusCode?: number;
4
+ /** Network error code (ENOTFOUND, ETIMEDOUT, ECONNRESET, …). */
5
+ code?: string;
6
+ }
7
+ /**
8
+ * Fetch the `latest` dist-tag manifest for `pkg` from the public npm
9
+ * registry. Returns the parsed JSON.
10
+ *
11
+ * Throws `NpmRegistryError` with a concrete `.message` describing the
12
+ * actual failure (HTTP status, network error code, parse failure). The
13
+ * caller should surface that string instead of replacing it with a
14
+ * generic "registry unreachable" — that wording was the original bug.
15
+ */
16
+ export declare function fetchLatestManifest(pkg: string, opts?: {
17
+ registry?: string;
18
+ timeoutMs?: number;
19
+ }): Promise<{
20
+ version: string;
21
+ [key: string]: unknown;
22
+ }>;
23
+ /**
24
+ * Convenience wrapper: returns just the `latest` version string.
25
+ */
26
+ export declare function fetchLatestVersion(pkg: string, opts?: {
27
+ registry?: string;
28
+ timeoutMs?: number;
29
+ }): Promise<string>;
30
+ //# sourceMappingURL=npm-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-registry.d.ts","sourceRoot":"","sources":["../../src/shared/npm-registry.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAYD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,CAoEtD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC,MAAM,CAAC,CAGjB"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Direct npm registry client.
3
+ *
4
+ * Replaces shelling out to `npm view ...` for version checks. Avoids two
5
+ * production failure modes seen on launchd-managed daemons (Bug 3 in
6
+ * v1.27.0):
7
+ *
8
+ * 1. `npm` not on the launchd PATH — the spawn fails before any HTTP
9
+ * call happens, and the previous code reported it as
10
+ * "Could not reach npm registry". Misleading; the registry is fine.
11
+ * 2. The npm CLI swallows useful diagnostics (auth-required messages,
12
+ * registry redirects, malformed manifests) into its own one-liner.
13
+ *
14
+ * The registry's `/{name}/latest` endpoint is unauthenticated, returns a
15
+ * compact JSON manifest, and is what `npm view ... version` itself
16
+ * resolves to. Hitting it directly removes the npm CLI dependency,
17
+ * surfaces real status codes, and gives us a concrete error string
18
+ * callers can show the user.
19
+ */
20
+ import { request } from 'https';
21
+ import { PHOTON_VERSION } from '../version.js';
22
+ const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
23
+ const DEFAULT_TIMEOUT_MS = 10_000;
24
+ function makeError(message, extras) {
25
+ const err = new Error(message);
26
+ if (extras?.statusCode !== undefined)
27
+ err.statusCode = extras.statusCode;
28
+ if (extras?.code !== undefined)
29
+ err.code = extras.code;
30
+ return err;
31
+ }
32
+ /**
33
+ * Fetch the `latest` dist-tag manifest for `pkg` from the public npm
34
+ * registry. Returns the parsed JSON.
35
+ *
36
+ * Throws `NpmRegistryError` with a concrete `.message` describing the
37
+ * actual failure (HTTP status, network error code, parse failure). The
38
+ * caller should surface that string instead of replacing it with a
39
+ * generic "registry unreachable" — that wording was the original bug.
40
+ */
41
+ export async function fetchLatestManifest(pkg, opts = {}) {
42
+ const registry = (opts.registry || process.env.npm_config_registry || DEFAULT_REGISTRY).replace(/\/+$/, '');
43
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
44
+ const url = `${registry}/${pkg}/latest`;
45
+ return await new Promise((resolve, reject) => {
46
+ const req = request(url, {
47
+ method: 'GET',
48
+ headers: {
49
+ // Required by some registries; npm CLI defaults exclude common
50
+ // browser User-Agents which can trip rate-limit / WAF rules on
51
+ // proxies. Identifying as our own client is the cleanest path.
52
+ 'User-Agent': `photon/${PHOTON_VERSION} (+https://github.com/portel-dev/photon)`,
53
+ Accept: 'application/json',
54
+ },
55
+ }, (res) => {
56
+ const status = res.statusCode ?? 0;
57
+ const chunks = [];
58
+ res.on('data', (chunk) => chunks.push(chunk));
59
+ res.on('end', () => {
60
+ const body = Buffer.concat(chunks).toString('utf-8');
61
+ if (status < 200 || status >= 300) {
62
+ // Trim body so a verbose HTML 502 page doesn't blow up logs.
63
+ const snippet = body.length > 200 ? `${body.slice(0, 200)}…` : body;
64
+ reject(makeError(`npm registry returned HTTP ${status} for ${pkg} (${snippet || 'no body'})`, { statusCode: status }));
65
+ return;
66
+ }
67
+ try {
68
+ const parsed = JSON.parse(body);
69
+ if (typeof parsed.version !== 'string' || parsed.version.length === 0) {
70
+ reject(makeError(`npm registry response missing 'version' for ${pkg}`));
71
+ return;
72
+ }
73
+ resolve(parsed);
74
+ }
75
+ catch (parseErr) {
76
+ const reason = parseErr instanceof Error ? parseErr.message : String(parseErr);
77
+ reject(makeError(`npm registry returned malformed JSON for ${pkg}: ${reason}`));
78
+ }
79
+ });
80
+ });
81
+ req.on('error', (err) => {
82
+ reject(makeError(`npm registry request failed for ${pkg}: ${err.code ?? ''} ${err.message}`.trim(), { code: err.code }));
83
+ });
84
+ req.setTimeout(timeoutMs, () => {
85
+ req.destroy(makeError(`npm registry request timed out after ${timeoutMs}ms`));
86
+ });
87
+ req.end();
88
+ });
89
+ }
90
+ /**
91
+ * Convenience wrapper: returns just the `latest` version string.
92
+ */
93
+ export async function fetchLatestVersion(pkg, opts = {}) {
94
+ const manifest = await fetchLatestManifest(pkg, opts);
95
+ return manifest.version;
96
+ }
97
+ //# sourceMappingURL=npm-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-registry.js","sourceRoot":"","sources":["../../src/shared/npm-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAS/C,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AACtD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,SAAS,SAAS,CAAC,OAAe,EAAE,MAAkC;IACpE,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,CAAqB,CAAC;IACnD,IAAI,MAAM,EAAE,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACzE,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,I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AAC;QAEH,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE;YAC7B,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,wCAAwC,SAAS,IAAI,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAW,EACX,OAAkD,EAAE;IAEpD,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC"}
@@ -12,6 +12,11 @@
12
12
  * Spawn a detached background process that fetches the latest version
13
13
  * and changelog, then writes the cache file. The parent process does
14
14
  * not wait for this — CLI exits immediately.
15
+ *
16
+ * The detached child does a direct HTTPS request to registry.npmjs.org
17
+ * rather than shelling out to `npm view`. Under launchd / sandboxed PATH,
18
+ * `npm` is frequently absent and the previous code silently exited
19
+ * without ever updating the cache (Bug 3 in v1.27.0).
15
20
  */
16
21
  export declare function refreshUpdateCache(): void;
17
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"version-notify.d.ts","sourceRoot":"","sources":["../src/version-notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA2DH;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAwCzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CA6BvC"}
1
+ {"version":3,"file":"version-notify.d.ts","sourceRoot":"","sources":["../src/version-notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA2DH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CA6DzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CA6BvC"}
@@ -61,39 +61,62 @@ function compareSemver(a, b) {
61
61
  * Spawn a detached background process that fetches the latest version
62
62
  * and changelog, then writes the cache file. The parent process does
63
63
  * not wait for this — CLI exits immediately.
64
+ *
65
+ * The detached child does a direct HTTPS request to registry.npmjs.org
66
+ * rather than shelling out to `npm view`. Under launchd / sandboxed PATH,
67
+ * `npm` is frequently absent and the previous code silently exited
68
+ * without ever updating the cache (Bug 3 in v1.27.0).
64
69
  */
65
70
  export function refreshUpdateCache() {
66
71
  const cache = readCache();
67
72
  if (cache && !isStale(cache))
68
73
  return;
69
74
  const cachePath = getCachePath();
75
+ const registry = (process.env.npm_config_registry || 'https://registry.npmjs.org').replace(/\/+$/, '');
76
+ const url = `${registry}/@portel/photon/latest`;
77
+ const userAgent = `photon/${PHOTON_VERSION} (+https://github.com/portel-dev/photon)`;
70
78
  const script = `
71
79
  const fs = require('fs');
72
- const { execSync } = require('child_process');
73
-
74
- let latest = null;
75
- try {
76
- latest = execSync('npm view @portel/photon version', {
77
- encoding: 'utf-8', timeout: 10000,
78
- stdio: ['pipe', 'pipe', 'pipe']
79
- }).trim();
80
- } catch { process.exit(0); }
80
+ const path = require('path');
81
+ const https = require('https');
81
82
 
82
- if (!latest) process.exit(0);
83
+ const req = https.request(${JSON.stringify(url)}, {
84
+ method: 'GET',
85
+ headers: { 'User-Agent': ${JSON.stringify(userAgent)}, Accept: 'application/json' },
86
+ }, (res) => {
87
+ if ((res.statusCode || 0) < 200 || (res.statusCode || 0) >= 300) {
88
+ res.resume();
89
+ process.exit(0);
90
+ }
91
+ let body = '';
92
+ res.setEncoding('utf-8');
93
+ res.on('data', (chunk) => { body += chunk; });
94
+ res.on('end', () => {
95
+ let latest;
96
+ try {
97
+ const parsed = JSON.parse(body);
98
+ if (typeof parsed.version !== 'string' || !parsed.version.length) process.exit(0);
99
+ latest = parsed.version;
100
+ } catch { process.exit(0); }
83
101
 
84
- const existing = (() => {
85
- try { return JSON.parse(fs.readFileSync(${JSON.stringify(cachePath)}, 'utf-8')); }
86
- catch { return {}; }
87
- })();
88
- const data = {
89
- latest,
90
- checkedAt: new Date().toISOString(),
91
- notifiedVersion: existing.notifiedVersion || undefined,
92
- };
93
- try {
94
- fs.mkdirSync(require('path').dirname(${JSON.stringify(cachePath)}), { recursive: true });
95
- fs.writeFileSync(${JSON.stringify(cachePath)}, JSON.stringify(data, null, 2));
96
- } catch {}
102
+ const existing = (() => {
103
+ try { return JSON.parse(fs.readFileSync(${JSON.stringify(cachePath)}, 'utf-8')); }
104
+ catch { return {}; }
105
+ })();
106
+ const data = {
107
+ latest,
108
+ checkedAt: new Date().toISOString(),
109
+ notifiedVersion: existing.notifiedVersion || undefined,
110
+ };
111
+ try {
112
+ fs.mkdirSync(path.dirname(${JSON.stringify(cachePath)}), { recursive: true });
113
+ fs.writeFileSync(${JSON.stringify(cachePath)}, JSON.stringify(data, null, 2));
114
+ } catch {}
115
+ });
116
+ });
117
+ req.on('error', () => process.exit(0));
118
+ req.setTimeout(10000, () => { req.destroy(); });
119
+ req.end();
97
120
  `;
98
121
  // Spawn detached — parent doesn't wait
99
122
  const child = spawn(process.execPath, ['-e', script], {
@@ -1 +1 @@
1
- {"version":3,"file":"version-notify.js","sourceRoot":"","sources":["../src/version-notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAErD,SAAS,YAAY;IACnB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,SAAS;IAChB,IAAI,CAAC;QAC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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,2DAA2D;IAC3D,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC;IACrC,UAAU,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portel/photon",
3
- "version": "1.27.0",
3
+ "version": "1.28.1",
4
4
  "description": "You focus on the business logic. We'll enable the rest. Build MCP servers and CLI tools in a single TypeScript file.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",