@halcyonlabs/app 0.47.0-halcyon.707 → 0.47.0-halcyon.708
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/index.d.ts +91 -91
- package/package.json +2 -2
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json +4 -4
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/revision +1 -1
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/source.json +1 -1
- package/server/dist/builtin-plugins/people/dist/host.js +9 -9
- package/server/dist/builtin-plugins/people/dist/host.meta.json +1 -1
- package/server/dist/builtin-plugins/people/dist/server.js +1 -1
|
@@ -4,5 +4,5 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
var D=Object.defineProperty;var o=(i,c)=>D(i,"name",{value:c,configurable:!0});import{cliCommand as d,defineCli as R}from"@get-bb/plugin-sdk";import{defineRpcContract as v}from"@get-bb/plugin-sdk";import{z as t}from"zod";var l=t.enum(["directory","grouped"]),b=t.string().min(1).max(80),x=t.object({kind:t.string(),reference:t.string(),group:t.string(),person:t.string().optional()}),
|
|
7
|
+
var D=Object.defineProperty;var o=(i,c)=>D(i,"name",{value:c,configurable:!0});import{cliCommand as d,defineCli as R}from"@get-bb/plugin-sdk";import{defineRpcContract as v}from"@get-bb/plugin-sdk";import{z as t}from"zod";var l=t.enum(["directory","grouped"]),b=t.string().min(1).max(80),x=t.object({kind:t.string(),reference:t.string(),group:t.string(),person:t.string().optional()}),_=t.object({predicate:t.string(),value:t.string(),label:b.optional(),confidence:t.number().min(0).max(1),status:t.string(),id:t.string().optional(),entity:t.string().optional(),source:x.optional(),observed:t.string().optional(),recorded:t.string().optional(),category:t.string().optional(),visibility:t.object({scope:t.enum(["private","named","general"]),people:t.array(t.string()).optional(),until:t.string().optional(),jobs:t.boolean().optional()}).optional(),supersedes:t.string().optional(),sourcesCompared:t.array(t.string()).optional()}).passthrough(),g=t.object({entity:t.string().optional(),name:t.string().optional(),facts:t.array(_)}).passthrough(),m=t.object({hostId:t.string().min(1),entity:t.string().min(1).max(200)}),w=m.extend({factId:t.string().min(1),value:t.string().trim().min(1).max(2e3),reason:t.string().trim().refine(i=>new TextEncoder().encode(i).length<=100,"Keep the source note within 100 bytes")}),h=t.object({id:t.string(),added:t.boolean()}).passthrough(),C=t.object({type:t.literal("fact"),entity:t.string(),predicate:t.string(),value:t.string(),label:b.optional(),source:x,observed:t.string(),confidence:t.literal(1),category:t.string(),visibility:t.object({scope:t.literal("private")}),supersedes:t.string()}),k=v({list:{input:t.null(),output:t.array(g)},lookup:{input:t.object({query:t.string().min(1).max(200)}),output:t.array(g)},known:{input:t.object({entity:t.string().min(1).max(200)}),output:g},record:{input:t.object({record:C}),output:h}}),I=v({stations:{input:t.null(),output:t.array(t.object({id:t.string(),name:t.string(),status:t.string()}))},lookup:{input:t.object({hostId:t.string(),query:t.string().trim().max(200).default("")}),output:t.array(g)},known:{input:m,output:g},correct:{input:w,output:h},undo:{input:m.extend({factId:t.string()}),output:h},getDefault:{input:t.null(),output:l},setDefault:{input:t.object({view:l}),output:l}});import{randomUUID as q}from"node:crypto";function S(i){return!!(i.id&&i.source&&i.observed&&i.status!=="superseded"&&i.predicate!=="conflict")}o(S,"canCorrect");function P(i){let c=i.hosts.experimental_client({contract:k});async function f(r){let n=await i.sdk.hosts.get({hostId:r});if(n.machineProviderId!=="station"||n.status!=="connected")throw new Error("Choose a connected station.")}o(f,"station");async function a(r){return await f(r.hostId),c.call("known",{entity:r.entity},{hostId:r.hostId})}o(a,"known");async function u(r,n,s,e){if(!S(n)||!n.id||!n.observed)throw new Error("This fact has no editable source record.");let p=new Date(Math.max(Date.now(),Date.parse(n.observed)+1)).toISOString(),y=`chat:people:${q()}`,j=e?`${y}:${Buffer.from(e).toString("base64url")}`:y;return c.call("record",{record:{type:"fact",entity:r.entity,predicate:n.predicate,value:s.value,...s.label===void 0?{}:{label:s.label},source:{kind:"owner",reference:j,group:y},observed:p,confidence:1,category:n.category??"context",visibility:{scope:"private"},supersedes:n.id}},{hostId:r.hostId})}return o(u,"append"),{stations:o(async()=>(await i.sdk.hosts.list()).filter(r=>r.machineProviderId==="station").map(({id:r,name:n,status:s})=>({id:r,name:n,status:s})),"stations"),lookup:o(async({hostId:r,query:n})=>(await f(r),n?c.call("lookup",{query:n},{hostId:r}):c.call("list",null,{hostId:r})),"lookup"),known:a,correct:o(async r=>{let s=(await a(r)).facts.find(e=>e.id===r.factId);if(!s)throw new Error("The fact has changed. Refresh this person before correcting it.");return u(r,s,{value:r.value,label:s.label},r.reason)},"correct"),undo:o(async r=>{let n=await a(r),s=n.facts.find(p=>p.id===r.factId),e=s?.supersedes?n.facts.find(p=>p.id===s.supersedes):void 0;if(!s||!e)throw new Error("The earlier value is unavailable. Refresh this person.");return u(r,s,{value:e.value,label:e.label},"Undo correction")},"undo"),getDefault:o(async()=>l.parse(await i.storage.kv.get("default-view")??"directory"),"getDefault"),setDefault:o(async({view:r})=>(await i.storage.kv.set("default-view",r),r),"setDefault")}}o(P,"peopleService");function B(i){let c=P(i);async function f(e){let p=await e;return i.realtime.publish("changed",{}),p}o(f,"changed");let a={...c,correct:o(e=>f(c.correct(e)),"correct"),undo:o(e=>f(c.undo(e)),"undo"),setDefault:o(e=>f(c.setDefault(e)),"setDefault")};i.rpc.register(I,a);let u={name:"station",description:"Station host id",required:!0},r={name:"entity",description:"Person id returned by lookup",required:!0},n={name:"fact",description:"Fact event id returned by known",required:!0},s=o(e=>({exitCode:0,stdout:JSON.stringify(e)}),"json");i.cli.register(R({name:"people",summary:"Browse people, correct facts, and choose the default view",commands:{stations:d({summary:"List stations",run:o(async()=>s(await a.stations()),"run")}),lookup:d({summary:"Search people; omit words to browse all returned people",positionals:[u,{name:"query",description:"Search words"}],run:o(async e=>s(await a.lookup({hostId:e.positionals.station??"",query:e.positionals.query??""})),"run")}),known:d({summary:"Show every returned fact, source and history for a person",positionals:[u,r],run:o(async e=>s(await a.known(m.parse({hostId:e.positionals.station,entity:e.positionals.entity}))),"run")}),correct:d({summary:"Replace a fact while preserving its earlier value",positionals:[u,r,n,{name:"value",description:"Correct value",required:!0}],options:{reason:{type:"string",description:"Short source note"}},run:o(async e=>s(await a.correct(w.parse({hostId:e.positionals.station,entity:e.positionals.entity,factId:e.positionals.fact,value:e.positionals.value,reason:e.options.reason??""}))),"run")}),undo:d({summary:"Restore the earlier value with a new correction",positionals:[u,r,n],run:o(async e=>s(await a.undo({...m.parse({hostId:e.positionals.station,entity:e.positionals.entity}),factId:e.positionals.fact??""})),"run")}),"default get":d({summary:"Show the saved default",run:o(async()=>s(await a.getDefault()),"run")}),"default set":d({summary:"Save directory or grouped as the default",positionals:[{name:"view",description:"directory or grouped",required:!0}],run:o(async e=>s(await a.setDefault({view:l.parse(e.positionals.view)})),"run")})}}))}o(B,"plugin");export{B as default};
|
|
8
8
|
//# sourceMappingURL=server.js.map
|