@north-light/cli 0.3.673 → 0.3.674
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/core/substrate/delivery/deliver.js +3 -3
- package/dist/core/substrate/delivery/plan.d.ts +4 -0
- package/dist/core/substrate/delivery/plan.js +2 -2
- package/package.json +3 -3
- package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +24 -3
- package/packages/crouter-api/dist/core/substrate/delivery/plan.js +2 -0
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),delivered:[...e.delivered,...n.delivered]}}l(
|
|
1
|
+
var $=Object.defineProperty;var l=(t,e)=>$(t,"name",{value:e,configurable:!0});import{dirname as P}from"node:path";import{isCloudRole as T}from"../../canvas/person-state.js";import{machineEnvironmentOfProfile as H}from"../../runtime/runner/machine/environment.js";import{clearLedger as W,demoteTranscript as x,freezePreferences as j,loadLedger as Y,saveLedger as B}from"../../graph/exposures.js";import{recordWatches as U}from"../../graph/watches.js";import{publishMany as J}from"../../graph/events.js";import{checkoutsForCwd as y}from"../../graph/repo-sync/repos.js";import{liveLookups as K,profileObject as V,viewRepos as G}from"../../graph/reader.js";import{ownerForGrantee as X}from"../../graph/objects.js";import{resolveName as z}from"../../graph/names.js";import{SCOPE_VOCABULARY as Q}from"../../scopes.js";import{getNode as Z}from"../../canvas/index.js";import{recordMemoryReadsIn as q}from"../../canvas/memory-reads.js";import{lookupProfile as ee}from"../../profiles/manifest.js";import{getDefaultProfileId as te}from"../../profiles/default-binding.js";import{effectiveScopes as ne,profileNameFor as oe,scopeForCwd as ae}from"../subject-fields.js";import{spineDepth as re}from"../subject.js";import{appForNode as ie}from"../../canvas/node-agent-paths.js";import{interpolateNodePaths as se}from"../../canvas/paths.js";import{readableProjectForScopes as k}from"../../spaces/permissions.js";import{ApiError as m}from"../../../api/errors.js";import{buildContextBearings as ce}from"../../runtime/bearings.js";import{deliveryDocOf as N,listingCorpora as de,loadCorpus as w,nodeSubject as O,primeBodies as le,viewOwners as pe}from"./corpus.js";import{listingPrefixes as ue}from"./listings.js";import{planDelivery as me}from"./plan.js";import{renderEvent as R,renderExplicitRead as _}from"./render-event.js";import{renderConfigDelta as fe,renderKnowledge as we,renderPreferences as S,renderWorkspaceOpen as E}from"./render-boot.js";import{mapAsync as D}from"../../async-array.js";function f(t){if(t.class!=="node")throw new Error(`delivery needs a node reader, got ${t.class}`);return t}l(f,"nodeOf");const C="hypothetical";function h(t){return t.node.id===C}l(h,"isHypothetical");async function v(t,e){if(!h(e))return await ie(e.node.id);const n=await t.prepare("SELECT external_id FROM identities WHERE object = ?").get(e.app.id);if(!n)throw new Error(`app object ${e.app.id} has no identity`);return n.external_id}l(v,"granteeOf");async function ye(t,e,n,o=async(a,d)=>await y(t,a,d)){const a=f(e).node,d=new Set,r=new Date().toISOString(),s=[],i=[];for(const{doc:c,level:p}of n)p!=="content"||d.has(c.object.id)||(d.add(c.object.id),i.push({watcher:a,object:c.object,start:"deliver",opts:{readHeadsKey:c.headsKey}}),s.push({name:c.name,scope:c.ownerHandle,at:r,type:"loaded"}));await U(t,i),await J(t,i.map(c=>({event:"read",object:c.object,actor:a,attrs:{}})),o),h(f(e))||await q(t,a.id,s)}l(ye,"recordContentDelivery");async function I(t,e,n){if(await g(t,e,n))return e;const o=(await y(t,P(n))).filter(a=>!e.repos.some(d=>d.id===a.repo.id));return o.length===0?e:{...e,repos:[...e.repos,...o.map(a=>a.repo)],checkouts:[...e.checkouts,...o]}}l(I,"fileReadReader");async function g(t,e,n){const o=await v(t,e);return o==="app:terminal"&&T()&&e.profile!=null&&await H(e.profile.id)!==null&&!k(n,o,e.scopes??[],null)}l(g,"isMacEnforcedRead");async function A(t,e,n){if(!await g(t,e,n))return{absoluteFile:n};const o=new Map;for(const{root:a,repo:d}of e.checkouts)n.startsWith(a.endsWith("/")?a:`${a}/`)&&!o.has(d.id)&&o.set(d.id,a);return{absoluteFile:n,readFrontmatter:{},repoRoots:o,remotePath:!0}}l(A,"fileReadPayload");async function he(t,e,n){const o=await v(t,e);if(!(n.startsWith("/")&&(process.platform!=="linux"&&o==="app:terminal"||await g(t,e,n)||k(n,o,e.scopes??[],null))))throw new m(403,"scope_missing","read file is outside the run mounts")}l(he,"assertReadableFile");async function ve(t){const e=f(t.reader),n=e.node,o=await v(t.db,e),a=await w(t.db,t.reader,["slash-command"]);await le(t.db,a);const d=await D(a,async r=>{const s=await r.body();return{name:r.displayName,command_name:r.displayName,description:r.preview,canonical_body:s,execution_body:se(s,n.id,o)}});return{docs:a,commands:d}}l(ve,"slashCommands");function ge(t){if(t.shipped)return"builtin";switch(t.owner.type){case"node":return"node";case"repo":return"project";case"profile":return"profile";default:return"user"}}l(ge,"scopeOf");async function be(t,e){const n=[],o=new Set,a=await pe(t,e),d=await de(t,e,a);for(const r of a){const s=d.get(r.id);for(const i of s){n.push({name:i.displayName,kind:i.kind,scope:ge(i),shortForm:i.preview,gatewayVisible:!i.shipped}),o.add(i.displayName);const c=i.displayName===i.name?"":`${i.ownerHandle}/`;for(const p of ue(s,i.name))o.add(`${c}${p}`)}}return{refs:n,names:[...o]}}l(be,"composerNames");async function F(t,e){const n=f(t.reader),{db:o,ledger:a}=t,d=l(()=>{if(typeof e.subject!="string"||e.subject==="")throw new m(400,"usage",`delivery activity ${e.activity} requires a subject`);return e.subject},"requireSubject");switch(e.activity){case"boot":{if(e.inherited===!0){for(const[i,c]of a.objects)if(c.transcript===void 0)a.objects.delete(i);else{const{system:p,...u}=c;a.objects.set(i,u)}for(const[i,c]of a.listed)c.transcript===void 0?a.listed.delete(i):a.listed.set(i,{transcript:c.transcript});return a.preferenceSnapshot=null,{result:{content:"",inherited:!0},delivered:[]}}const r=h(n)?await je(t):await ce(n.node.id,t),s=await S({...t,channel:"system"});return j(a,s.content),{result:{content:r.content},delivered:[...r.delivered,...s.delivered]}}case"system-prompt":{if(a.preferenceSnapshot!==null)return{result:{content:a.preferenceSnapshot},delivered:[]};const r=await S({...t,channel:"system"});return{result:{content:j(a,r.content)},delivered:r.delivered}}case"compact":{for(const r of await w(o,n,["pre-command"]))x(a,r.object.id);return{result:{content:""},delivered:[]}}case"persona":{const r=await fe(t);return{result:{content:r.content},delivered:r.delivered}}case"file-read":{const r=d();await he(o,n,r);const s=await I(o,n,r),i={...t,reader:s},c=await R(i,"file-read",await A(o,n,r),await w(o,s,["file-read"]));return{result:{content:c.content},delivered:c.delivered}}case"command":case"pre-command":{const r=await R(t,e.activity,{command:d()});return{result:{content:r.content},delivered:r.delivered}}case"slash-command":{const{docs:r,commands:s}=await ve(t);if(e.subject===void 0||e.subject==="")return{result:{content:"",commands:s},delivered:[]};const i=r.findIndex(u=>u.displayName===e.subject||u.name===e.subject);if(i<0)throw new m(404,"not_found",`no slash command named ${e.subject}`);const c=r[i],p=await _(t,c,!0);return{result:{content:"",execution_body:s[i].execution_body,blocks:p.attachments===""?[]:[p.attachments]},delivered:[{doc:c,level:"content"},...p.delivered]}}case"workspace-open":{const r=await E(t);return{result:{content:r.content},delivered:r.delivered}}case"document-read":{const r=await L(o,n,d()),s=await _(t,await N(o,n,r),!0);return{result:{content:s.attachments},delivered:s.delivered}}case"names":return{result:{content:"",...await be(o,n)},delivered:[]};default:throw new m(400,"usage",`unknown delivery activity ${String(e.activity)}`)}}l(F,"render");async function je(t){const e=await we(t),n=await E(t);return{content:[e.content,n.content].filter(o=>o!=="").join(`
|
|
2
|
+
`),delivered:[...e.delivered,...n.delivered]}}l(je,"hypotheticalBearings");async function L(t,e,n){const o=await z(t,e,n);if("object"in o&&o.object.type==="document")return o.object;throw"ambiguous"in o?new m(409,"ambiguous",`${n} names ${o.ambiguous.length} documents; name one as <type>:<owner>/<name>`):new m(404,"not_found",`no document ${n} the reader can read`)}l(L,"readDocument");const ke=["workspace-open","document-read"];async function et(t,e,n){if(ke.includes(n.activity))throw new m(400,"usage",`delivery activity ${n.activity} is available to a dry run only`);const o=f(e).node;n.activity==="boot"&&n.inherited!==!0&&await W(t,o.id);const a=await Y(t,o.id),d={db:t,reader:e,subject:await O(t,e),ledger:a,channel:"transcript"},{result:r,delivered:s}=await F(d,n);return await ye(t,e,s),await B(t,a),r}l(et,"deliver");const Ne={boot:"boot","workspace-open":"workspace-open","file-read":"file-read","document-read":"document-read",command:"command","pre-command":"pre-command","slash-command":"slash-command"};async function tt(t,e){const n=await Z(t);if(n===null)throw new m(404,"not_found",`no node ${t}`);return{cwd:e.cwd??n.cwd,profile:e.profile!==void 0?e.profile:n.profile_id,grantee:e.grantee??n.grantee,kind:e.kind??n.kind,mode:e.mode??n.mode,lifecycle:e.lifecycle??n.lifecycle,hasManager:e.hasManager??(n.parent??null)!==null,depth:e.depth??await re(t)}}l(tt,"hypotheticalFrom");function Oe(t,e){if(t===null)return null;if(t===void 0||t==="")return te(e);const n=ee(t);if(n.kind!=="resolved"){const o=`no profile ${t}`;throw new m(404,"not_found",o,{error:"not_found",message:o,next:"List profile ids and names with `crtr profile list`."})}return n.entry.profileId}l(Oe,"resolveProfileId");async function nt(t,e){const n=await X(t,e.grantee??"app:terminal"),o=Oe(e.profile,e.cwd),a=await G(t,e.cwd,o,async(p,u)=>await y(t,p,u),K(t)),{repos:d}=a,r=e.mode??"base",i={class:"node",node:{id:C,seq:0,type:"node",kind:e.kind??"general",owner:n.id,privacy:"private",name:"hypothetical",preview:"",created_at:new Date(0).toISOString(),deleted_at:null},app:n,scopes:[...Q],cwd:e.cwd,...a,profile:o===null?null:await V(t,o,n)},c={kind:e.kind??"general",mode:r,lifecycle:e.lifecycle??(r==="orchestrator"?"resident":"terminal"),hasManager:e.hasManager??!0,cwd:e.cwd,scope:ae(e.cwd),orchestration:{depth:e.depth??0},profile:oe(o),app:e.grantee??"app:terminal",scopes:ne(null),repo:[...d,...a.projectRepos].map(p=>p.name)};return{reader:i,subject:c}}l(nt,"hypotheticalReader");async function ot(t,e,n,o,a){const r={node:f(e).node.id,preferenceSnapshot:null,objects:new Map,listed:new Map},s={...a??await O(t,e),...o},i={db:t,reader:e,subject:s,ledger:r,channel:"transcript"},{result:c}=await F(i,n),p=Ne[n.activity];let u=null;if(p!==void 0){const M=n.activity==="file-read"?await A(t,f(e),n.subject):n.activity==="command"||n.activity==="pre-command"?{command:n.subject}:n.activity==="document-read"&&n.subject!==void 0?{doc:await N(t,e,await L(t,e,n.subject))}:{},b=n.activity==="file-read"&&n.subject!==void 0?await I(t,f(e),n.subject):e;u=await me(t,s,b,await w(t,b,[p]),p,M)}return{result:c,plan:u}}l(ot,"inspect");async function at(t,e,n){const o=await t.prepare(`SELECT o.*, MAX(r.number) AS to_seq, string_agg(DISTINCT a.id, ',') AS authors
|
|
3
3
|
FROM watches w JOIN objects o ON o.id = w.object AND o.type = 'document' AND o.deleted_at IS NULL
|
|
4
4
|
JOIN revisions r ON r.document = o.id LEFT JOIN objects a ON a.id = r.author
|
|
5
5
|
WHERE w.watcher = ? AND r.created_at > ? AND (r.author IS NULL OR r.author != ?)
|
|
6
|
-
GROUP BY o.id ORDER BY o.seq`).all(e.id,n,e.id);return await
|
|
6
|
+
GROUP BY o.id ORDER BY o.seq`).all(e.id,n,e.id);return await D(o,async({to_seq:a,authors:d,...r})=>{const s=await t.prepare("SELECT MAX(number) AS seq FROM revisions WHERE document = ? AND created_at <= ?").get(r.id,n);return{doc:r,from:s.seq,to:a,authors:d===null?[]:d.split(",")}})}l(at,"changedWhileDone");export{ke as DRY_RUN_ONLY,at as changedWhileDone,et as deliver,tt as hypotheticalFrom,nt as hypotheticalReader,ot as inspect,ye as recordContentDelivery};
|
|
@@ -12,6 +12,10 @@ export interface DeliveryPayload {
|
|
|
12
12
|
absoluteFile?: string;
|
|
13
13
|
/** `file-read`: the read file's frontmatter; parsed from the file when omitted. */
|
|
14
14
|
readFrontmatter?: Record<string, unknown>;
|
|
15
|
+
/** `file-read`: checkout root of each repo (by id) enclosing the file; computed from the file's disk when omitted. */
|
|
16
|
+
repoRoots?: ReadonlyMap<string, string>;
|
|
17
|
+
/** `file-read`: the file lives on another machine, so the planner must not realpath it or look at it on this disk. */
|
|
18
|
+
remotePath?: boolean;
|
|
15
19
|
/** `document-read`: the document delivered or read; it never delivers to itself. */
|
|
16
20
|
doc?: DeliveryDoc;
|
|
17
21
|
/** `command` / `pre-command`: the command string. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var p=Object.defineProperty;var u=(e,r)=>p(e,"name",{value:r,configurable:!0});import{dirname as h}from"node:path";import{parseFrontmatterGeneric as w}from"../../frontmatter.js";import{readText as g,realpathOrSelf as R}from"../../fs-utils.js";import{checkoutChainOf as b}from"../../checkout-identities.js";import{readableRepos as k}from"../../graph/repo-sync/repos.js";import{minRung as O,rungAtLeast as F,rungRank as m}from"../schema.js";import{ruleConstraintsFit as v,ruleGate as
|
|
2
|
-
WHERE o.type = 'repo' AND i.scheme = 'local-path'`).all();for(const{id:o,path:s,person:d}of a)!
|
|
1
|
+
var p=Object.defineProperty;var u=(e,r)=>p(e,"name",{value:r,configurable:!0});import{dirname as h}from"node:path";import{parseFrontmatterGeneric as w}from"../../frontmatter.js";import{readText as g,realpathOrSelf as R}from"../../fs-utils.js";import{checkoutChainOf as b}from"../../checkout-identities.js";import{readableRepos as k}from"../../graph/repo-sync/repos.js";import{minRung as O,rungAtLeast as F,rungRank as m}from"../schema.js";import{ruleConstraintsFit as v,ruleGate as N}from"./match.js";import{personIdAsync as x}from"../../canvas/person.js";function y(e){return e.doc.ownNode?"knowledge":e.doc.kind}u(y,"bootPartitionOf");async function H(e,r,t,i,n,a={}){const o=await A(e,n,a),d=(n==="document-read"&&a.doc!==void 0?i.filter(l=>l.object.id!==a.doc.object.id):i).map(l=>W(l,r,n,o));return j(n,d),{on:n,subject:r,reader:t,docs:d}}u(H,"planDelivery");async function A(e,r,t){if(r!=="file-read"||t.absoluteFile===void 0||t.remotePath)return t;const i=R(t.absoluteFile);return{...t,absoluteFile:i,readFrontmatter:t.readFrontmatter??E(i),repoRoots:await S(e,i)}}u(A,"resolvePayload");function E(e){if(!/\.(md|mdx|markdown)$/i.test(e))return{};try{return w(g(e)).data??{}}catch{return{}}}u(E,"readFileFrontmatter");async function S(e,r){const t=new Map;let i;const n=u(async()=>i??=await x(),"personOf");for(const o of await b(e,h(r),n)){if(!o.ok)break;for(const s of(await k(e,await n(),o.scheme,o.externalId)).readable)t.has(s.id)||t.set(s.id,o.root)}const a=await e.prepare(`SELECT o.id, i.external_id AS path, i.person AS person FROM identities i JOIN objects o ON o.id = i.object
|
|
2
|
+
WHERE o.type = 'repo' AND i.scheme = 'local-path'`).all();for(const{id:o,path:s,person:d}of a)!t.has(o)&&r.startsWith(s.endsWith("/")?s:`${s}/`)&&d===await n()&&t.set(o,s);return t}u(S,"repoRootsOf");function W(e,r,t,i){const n=e.rules.filter(c=>c.on===t).map(c=>{const f=N(c,r);return{rule:c,gate:f,matched:f.pass&&v(c,e,t,i)}});let a=null;for(const{rule:c,matched:f}of n)f&&(a===null||m(c.deliver)>m(a.deliver))&&(a=c);const o=a?.deliver??"none",s=(t==="boot"||t==="workspace-open")&&!e.ownNode?e.limit:null,d=s===null?o:O(o,s),l=t==="boot"&&e.ownNode&&n.length===0?"name":d;return{doc:e,authoredRules:n,matchedRule:a,authoredRung:o,limit:s,cappedRung:d,ruleGate:n.length===0?null:a!==null?{pass:!0}:n.find(c=>!c.gate.pass)?.gate??{pass:!0},finalRung:l,winner:!1,shadowedBy:null}}u(W,"decide");function $(e,r){if(r==="boot"){const t=e.authoredRules.length>0&&e.authoredRules.every(i=>!i.gate.pass);return e.limit!=="none"&&!t}return F(e.finalRung,"name")}u($,"holdsName");function j(e,r){const t=e==="boot"||e==="workspace-open",i=new Map;for(const n of r){if(!$(n,e))continue;if(!t){n.winner=!0;continue}const a=e==="boot"?`${y(n)}:${n.doc.name}`:n.doc.name,o=i.get(a);o===void 0?(i.set(a,n),n.winner=!0):n.shadowedBy=o.doc}}u(j,"resolveWinners");export{y as bootPartitionOf,H as planDelivery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.674",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
},
|
|
157
157
|
"license": "UNLICENSED",
|
|
158
158
|
"dependencies": {
|
|
159
|
-
"@north-light/identity": "0.3.
|
|
160
|
-
"@north-light/plugin": "0.3.
|
|
159
|
+
"@north-light/identity": "0.3.674",
|
|
160
|
+
"@north-light/plugin": "0.3.674",
|
|
161
161
|
"@earendil-works/chord": "1.5.2",
|
|
162
162
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* caller runs it inside one `withCanvasWrite`, so exposures, watches and
|
|
5
5
|
* events land together or not at all. */
|
|
6
6
|
import { dirname } from 'node:path';
|
|
7
|
+
import { isCloudRole } from '../../canvas/person-state.js';
|
|
8
|
+
import { machineEnvironmentOfProfile } from '../../runtime/runner/machine/environment.js';
|
|
7
9
|
import { clearLedger, demoteTranscript, freezePreferences, loadLedger, saveLedger } from '../../graph/exposures.js';
|
|
8
10
|
import { recordWatches } from '../../graph/watches.js';
|
|
9
11
|
import { publishMany } from '../../graph/events.js';
|
|
@@ -70,13 +72,32 @@ export async function recordContentDelivery(db, reader, delivered, reposFn = asy
|
|
|
70
72
|
}
|
|
71
73
|
/** The file-read reader: the node's own view plus the repos enclosing the read file, so their rules apply. */
|
|
72
74
|
async function fileReadReader(db, reader, file) {
|
|
75
|
+
if (await isMacEnforcedRead(db, reader, file))
|
|
76
|
+
return reader;
|
|
73
77
|
const extra = (await checkoutsForCwd(db, dirname(file))).filter((c) => !reader.repos.some((own) => own.id === c.repo.id));
|
|
74
78
|
return extra.length === 0 ? reader
|
|
75
79
|
: { ...reader, repos: [...reader.repos, ...extra.map((c) => c.repo)], checkouts: [...reader.checkouts, ...extra] };
|
|
76
80
|
}
|
|
81
|
+
/** On a cloud role a terminal-app node's files live on its Mac, which enforces file access itself; the control plane cannot see them,
|
|
82
|
+
* so this read passes on the Mac's say-so and the control plane must not touch its own disk at the path. */
|
|
83
|
+
async function isMacEnforcedRead(db, reader, file) {
|
|
84
|
+
const grantee = await granteeOf(db, reader);
|
|
85
|
+
return grantee === 'app:terminal' && isCloudRole() && reader.profile != null && await machineEnvironmentOfProfile(reader.profile.id) !== null
|
|
86
|
+
&& !readableProjectForScopes(file, grantee, reader.scopes ?? [], null);
|
|
87
|
+
}
|
|
88
|
+
/** The file-read payload: for a Mac-enforced read, empty frontmatter and the repo roots from the node's stored checkouts that enclose the path. */
|
|
89
|
+
async function fileReadPayload(db, reader, file) {
|
|
90
|
+
if (!await isMacEnforcedRead(db, reader, file))
|
|
91
|
+
return { absoluteFile: file };
|
|
92
|
+
const roots = new Map();
|
|
93
|
+
for (const { root, repo } of reader.checkouts)
|
|
94
|
+
if (file.startsWith(root.endsWith('/') ? root : `${root}/`) && !roots.has(repo.id))
|
|
95
|
+
roots.set(repo.id, root);
|
|
96
|
+
return { absoluteFile: file, readFrontmatter: {}, repoRoots: roots, remotePath: true };
|
|
97
|
+
}
|
|
77
98
|
async function assertReadableFile(db, reader, file) {
|
|
78
99
|
const grantee = await granteeOf(db, reader);
|
|
79
|
-
const ok = file.startsWith('/') && ((process.platform !== 'linux' && grantee === 'app:terminal')
|
|
100
|
+
const ok = file.startsWith('/') && ((process.platform !== 'linux' && grantee === 'app:terminal') || await isMacEnforcedRead(db, reader, file)
|
|
80
101
|
|| readableProjectForScopes(file, grantee, reader.scopes ?? [], null));
|
|
81
102
|
if (!ok)
|
|
82
103
|
throw new ApiError(403, 'scope_missing', 'read file is outside the run mounts');
|
|
@@ -174,7 +195,7 @@ async function render(ctx, req) {
|
|
|
174
195
|
await assertReadableFile(db, reader, file);
|
|
175
196
|
const fileReader = await fileReadReader(db, reader, file);
|
|
176
197
|
const fileCtx = { ...ctx, reader: fileReader };
|
|
177
|
-
const r = await renderEvent(fileCtx, 'file-read',
|
|
198
|
+
const r = await renderEvent(fileCtx, 'file-read', await fileReadPayload(db, reader, file), await loadCorpus(db, fileReader, ['file-read']));
|
|
178
199
|
return { result: { content: r.content }, delivered: r.delivered };
|
|
179
200
|
}
|
|
180
201
|
case 'command':
|
|
@@ -313,7 +334,7 @@ export async function inspect(db, reader, req, subjectOverride, baseSubject) {
|
|
|
313
334
|
const on = ACTIVITY_ON[req.activity];
|
|
314
335
|
let plan = null;
|
|
315
336
|
if (on !== undefined) {
|
|
316
|
-
const payload = req.activity === 'file-read' ?
|
|
337
|
+
const payload = req.activity === 'file-read' ? await fileReadPayload(db, nodeOf(reader), req.subject)
|
|
317
338
|
: req.activity === 'command' || req.activity === 'pre-command' ? { command: req.subject }
|
|
318
339
|
: req.activity === 'document-read' && req.subject !== undefined ? { doc: await deliveryDocOf(db, reader, await readDocument(db, reader, req.subject)) }
|
|
319
340
|
: {};
|
|
@@ -33,6 +33,8 @@ export async function planDelivery(db, subject, reader, corpus, on, payload = {}
|
|
|
33
33
|
async function resolvePayload(db, on, payload) {
|
|
34
34
|
if (on !== 'file-read' || payload.absoluteFile === undefined)
|
|
35
35
|
return payload;
|
|
36
|
+
if (payload.remotePath)
|
|
37
|
+
return payload;
|
|
36
38
|
const absoluteFile = realpathOrSelf(payload.absoluteFile);
|
|
37
39
|
return {
|
|
38
40
|
...payload,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.674",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.674",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@north-light/api": "0.3.
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
30
|
+
"@north-light/api": "0.3.674",
|
|
31
|
+
"@north-light/identity": "0.3.674"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|
|
34
34
|
"publishConfig": {
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.674",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.674",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
29
29
|
"@milkdown/prose": "^7.22.3",
|
|
30
30
|
"@milkdown/utils": "^7.22.3",
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
32
|
-
"@north-light/plugin": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.674",
|
|
32
|
+
"@north-light/plugin": "0.3.674",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -10667,17 +10667,17 @@
|
|
|
10667
10667
|
},
|
|
10668
10668
|
"packages/crouter-api": {
|
|
10669
10669
|
"name": "@north-light/api",
|
|
10670
|
-
"version": "0.3.
|
|
10670
|
+
"version": "0.3.674",
|
|
10671
10671
|
"license": "UNLICENSED"
|
|
10672
10672
|
},
|
|
10673
10673
|
"packages/crouter-env-docker": {
|
|
10674
10674
|
"name": "@north-light/env-docker",
|
|
10675
|
-
"version": "0.3.
|
|
10675
|
+
"version": "0.3.674",
|
|
10676
10676
|
"license": "UNLICENSED"
|
|
10677
10677
|
},
|
|
10678
10678
|
"packages/crouter-identity": {
|
|
10679
10679
|
"name": "@north-light/identity",
|
|
10680
|
-
"version": "0.3.
|
|
10680
|
+
"version": "0.3.674",
|
|
10681
10681
|
"license": "UNLICENSED",
|
|
10682
10682
|
"dependencies": {
|
|
10683
10683
|
"jose": "^6.2.1"
|
|
@@ -10685,21 +10685,21 @@
|
|
|
10685
10685
|
},
|
|
10686
10686
|
"packages/crouter-plugin": {
|
|
10687
10687
|
"name": "@north-light/plugin",
|
|
10688
|
-
"version": "0.3.
|
|
10688
|
+
"version": "0.3.674",
|
|
10689
10689
|
"license": "UNLICENSED",
|
|
10690
10690
|
"dependencies": {
|
|
10691
|
-
"@north-light/api": "0.3.
|
|
10692
|
-
"@north-light/identity": "0.3.
|
|
10691
|
+
"@north-light/api": "0.3.674",
|
|
10692
|
+
"@north-light/identity": "0.3.674"
|
|
10693
10693
|
}
|
|
10694
10694
|
},
|
|
10695
10695
|
"packages/crouter-sdk": {
|
|
10696
10696
|
"name": "@north-light/sdk",
|
|
10697
|
-
"version": "0.3.
|
|
10697
|
+
"version": "0.3.674",
|
|
10698
10698
|
"license": "UNLICENSED",
|
|
10699
10699
|
"dependencies": {
|
|
10700
|
-
"@north-light/api": "0.3.
|
|
10701
|
-
"@north-light/identity": "0.3.
|
|
10702
|
-
"@north-light/plugin": "0.3.
|
|
10700
|
+
"@north-light/api": "0.3.674",
|
|
10701
|
+
"@north-light/identity": "0.3.674",
|
|
10702
|
+
"@north-light/plugin": "0.3.674",
|
|
10703
10703
|
"jose": "^6.2.1"
|
|
10704
10704
|
},
|
|
10705
10705
|
"bin": {
|