@thegpvc/gp-foundry 0.2.0 → 0.2.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.
@@ -35,8 +35,8 @@ inputs:
35
35
  Token used ONLY to read the check-runs rollup for the head SHA. That read
36
36
  needs the Checks permission, which is a GitHub App permission — a
37
37
  fine-grained PAT cannot be granted it, so passing the harness PAT here 403s
38
- and the gate merges nothing. Pass ${{ github.token }} (an App installation
39
- token) and give the job `permissions: checks: read`. Defaults to `token`,
38
+ and the gate merges nothing. Pass the built-in GITHUB_TOKEN (an App
39
+ installation token) and give the job `permissions: checks: read`. Defaults to `token`,
40
40
  which is correct only when that token is a GitHub App installation token.
41
41
  required: false
42
42
  default: ""
@@ -78,8 +78,8 @@ inputs:
78
78
  Optional newline-separated NAME=VALUE pairs exported into the agent's
79
79
  environment before the CLI runs, so roles can reach extra secrets (e.g. a
80
80
  Sentry token). Values are passed in by the caller because composites have
81
- no secrets context; the compiler fills these from config.agent.secrets as
82
- NAME=${{ secrets.NAME }}. Values are never echoed.
81
+ no secrets context; the compiler fills these from config.agent.secrets, one
82
+ NAME=<value> pair per line. Values are never echoed.
83
83
  required: false
84
84
  default: ""
85
85
 
@@ -52,8 +52,8 @@ Expecting one of '${i.join("', '")}'`);let o=`${e}Help`;return this.on(o,s=>{let
52
52
  `,l.length-_>m&&k>_?T+=l.slice(_,k)+`
53
53
  `+l.slice(k+1):T+=l.slice(_),T.slice(1)}function Dn(l){let m="",C=0;for(let w=0;w<l.length;C>=65536?w+=2:w++){C=he(l,w);let _=ee[C];!_&&xe(C)?(m+=l[w],C>=65536&&(m+=l[w+1])):m+=_||fe(C)}return m}function bn(l,m,C){let w="",_=l.tag;for(let S=0,k=C.length;S<k;S+=1){let N=C[S];l.replacer&&(N=l.replacer.call(C,String(S),N)),(y(l,m,N,!1,!1)||typeof N>"u"&&y(l,m,null,!1,!1))&&(w!==""&&(w+=","+(l.condenseFlow?"":" ")),w+=l.dump)}l.tag=_,l.dump="["+w+"]"}function yn(l,m,C,w){let _="",S=l.tag;for(let k=0,N=C.length;k<N;k+=1){let T=C[k];l.replacer&&(T=l.replacer.call(C,String(k),T)),(y(l,m+1,T,!0,!0,!1,!0)||typeof T>"u"&&y(l,m+1,null,!0,!0,!1,!0))&&((!w||_!=="")&&(_+=Pe(l,m)),l.dump&&d===l.dump.charCodeAt(0)?_+="-":_+="- ",_+=l.dump)}l.tag=S,l.dump=_||"[]"}function qn(l,m,C){let w="",_=l.tag,S=Object.keys(C);for(let k=0,N=S.length;k<N;k+=1){let T="";w!==""&&(T+=", "),l.condenseFlow&&(T+='"');let I=S[k],F=C[I];l.replacer&&(F=l.replacer.call(C,I,F)),y(l,m,I,!1,!1)&&(l.dump.length>1024&&(T+="? "),T+=l.dump+(l.condenseFlow?'"':"")+":"+(l.condenseFlow?"":" "),y(l,m,F,!1,!1)&&(T+=l.dump,w+=T))}l.tag=_,l.dump="{"+w+"}"}function n(l,m,C,w){let _="",S=l.tag,k=Object.keys(C);if(l.sortKeys===!0)k.sort();else if(typeof l.sortKeys=="function")k.sort(l.sortKeys);else if(l.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let N=0,T=k.length;N<T;N+=1){let I="";(!w||_!=="")&&(I+=Pe(l,m));let F=k[N],q=C[F];if(l.replacer&&(q=l.replacer.call(C,F,q)),!y(l,m+1,F,!0,!0,!0))continue;let G=l.tag!==null&&l.tag!=="?"||l.dump&&l.dump.length>1024;G&&(l.dump&&d===l.dump.charCodeAt(0)?I+="?":I+="? "),I+=l.dump,G&&(I+=Pe(l,m)),y(l,m+1,q,!0,G)&&(l.dump&&d===l.dump.charCodeAt(0)?I+=":":I+=": ",I+=l.dump,_+=I)}l.tag=S,l.dump=_||"{}"}function p(l,m,C){let w=C?l.explicitTypes:l.implicitTypes;for(let _=0,S=w.length;_<S;_+=1){let k=w[_];if((k.instanceOf||k.predicate)&&(!k.instanceOf||typeof m=="object"&&m instanceof k.instanceOf)&&(!k.predicate||k.predicate(m))){if(C?k.multi&&k.representName?l.tag=k.representName(m):l.tag=k.tag:l.tag="?",k.represent){let N=l.styleMap[k.tag]||k.defaultStyle,T;if(i.call(k.represent)==="[object Function]")T=k.represent(m,N);else if(o.call(k.represent,N))T=k.represent[N](m,N);else throw new e("!<"+k.tag+'> tag resolver accepts not "'+N+'" style');l.dump=T}return!0}}return!1}function y(l,m,C,w,_,S,k){l.tag=null,l.dump=C,p(l,C,!1)||p(l,C,!0);let N=i.call(l.dump),T=w;w&&(w=l.flowLevel<0||l.flowLevel>m);let I=N==="[object Object]"||N==="[object Array]",F,q;if(I&&(F=l.duplicates.indexOf(C),q=F!==-1),(l.tag!==null&&l.tag!=="?"||q||l.indent!==2&&m>0)&&(_=!1),q&&l.usedDuplicates[F])l.dump="*ref_"+F;else{if(I&&q&&!l.usedDuplicates[F]&&(l.usedDuplicates[F]=!0),N==="[object Object]")w&&Object.keys(l.dump).length!==0?(n(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(qn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object Array]")w&&l.dump.length!==0?(l.noArrayIndent&&!k&&m>0?yn(l,m-1,l.dump,_):yn(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(bn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object String]")l.tag!=="?"&&Ln(l,l.dump,m,S,T);else{if(N==="[object Undefined]")return!1;if(l.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+N)}if(l.tag!==null&&l.tag!=="?"){let G=encodeURI(l.tag[0]==="!"?l.tag.slice(1):l.tag).replace(/!/g,"%21");l.tag[0]==="!"?G="!"+G:G.slice(0,18)==="tag:yaml.org,2002:"?G="!!"+G.slice(18):G="!<"+G+">",l.dump=G+" "+l.dump}}return!0}function A(l,m){let C=[],w=[];b(l,C,w);let _=w.length;for(let S=0;S<_;S+=1)m.duplicates.push(C[w[S]]);m.usedDuplicates=new Array(_)}function b(l,m,C){if(l!==null&&typeof l=="object"){let w=m.indexOf(l);if(w!==-1)C.indexOf(w)===-1&&C.push(w);else if(m.push(l),Array.isArray(l))for(let _=0,S=l.length;_<S;_+=1)b(l[_],m,C);else{let _=Object.keys(l);for(let S=0,k=_.length;S<k;S+=1)b(l[_[S]],m,C)}}}function O(l,m){m=m||{};let C=new Mn(m);C.noRefs||A(l,C);let w=l;return C.replacer&&(w=C.replacer.call({"":w},"",w)),y(C,0,w,!0,!0)?C.dump+`
54
54
  `:""}return St.dump=O,St}var Oi;function zr(){if(Oi)return ie;Oi=1;let r=Kr(),e=Jr();function t(i,o){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return ie.Type=re(),ie.Schema=$i(),ie.FAILSAFE_SCHEMA=Ii(),ie.JSON_SCHEMA=Li(),ie.CORE_SCHEMA=ji(),ie.DEFAULT_SCHEMA=vt(),ie.load=r.load,ie.loadAll=r.loadAll,ie.dump=e.dump,ie.YAMLException=en(),ie.types={binary:Bi(),float:Mi(),map:Hi(),null:Ri(),pairs:Vi(),set:Wi(),timestamp:Di(),bool:Pi(),int:Fi(),merge:qi(),omap:Ui(),seq:Ni(),str:Ti()},ie.safeLoad=t("safeLoad","load"),ie.safeLoadAll=t("safeLoadAll","loadAll"),ie.safeDump=t("safeDump","dump"),ie}var Xr=zr(),ye=Gr(Xr),{Type:ws,Schema:_s,FAILSAFE_SCHEMA:As,JSON_SCHEMA:xs,CORE_SCHEMA:ks,DEFAULT_SCHEMA:Cs,load:Es,loadAll:Ss,dump:vs,YAMLException:Os,types:$s,safeLoad:Ts,safeLoadAll:Ns,safeDump:Hs}=ye;R();R();function nn(r){return`\${{ secrets.${r} }}`}function Ne(r,e){if(!e)return"";let t=r.specDir?.replace(/\/+$/,"");return t?`${t}/${e}`:e}function ue(r){let e=ze(r.config);return e.mode==="app"?"${{ steps.app-token.outputs.token }}":e.mode==="pat"?nn(e.tokenSecret??"AGENT_PAT"):"${{ github.token }}"}function Tn(r){let e=ze(r.config);if(!(e.mode!=="app"||!e.appIdSecret||!e.appKeySecret))return{uses:"actions/create-github-app-token@v3",id:"app-token",name:"Mint app token",with:{"app-id":nn(e.appIdSecret),"private-key":nn(e.appKeySecret)}}}function Nn(r,e={}){let t={token:ue(r)};return e.ref&&(t.ref=e.ref),e.fetchDepth!==void 0&&(t["fetch-depth"]=e.fetchDepth),{uses:"actions/checkout@v5",name:"Checkout",with:t}}function je(){return{uses:"./.github/agent-setup",name:"Setup agent toolchain"}}function Gi(r){let e=r.config.identity,t=e.git_name??e.bot_login??"gp-foundry agent",i=e.git_email??`${e.bot_login??"gp-foundry-agent"}@users.noreply.github.com`;return Ee({name:"Configure git identity",env:{GIT_NAME:t,GIT_EMAIL:i},run:`git config user.name "$GIT_NAME"
55
- git config user.email "$GIT_EMAIL"`})}function tn(r,e,t){let i={type:e,number:t,token:ue(r)},o=r.config.identity?.bot_login;return o&&(i["trusted-authors"]=o),{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:i}}function De(r,e){let t=r.node,i=r.config,o={"role-file":Ne(r,t.files.role),model:i.agent.model,"comms-file":Ne(r,"agents/communication.md"),"scope-path":Ne(r,"agents/scope.yaml"),"claude-code-oauth-token":nn(i.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"),"github-token":ue(r)};e.withContext&&(o["context-file"]="${{ steps.ctx.outputs.context-file }}"),i.agent.conventions&&(o.conventions=i.agent.conventions),i.agent.secrets?.length&&(o["extra-env"]=i.agent.secrets.map(a=>`${a}=${nn(a)}`).join(`
56
- `));let s=t.files.prompt;return s&&(o["prompt-override-file"]=Ne(r,s)),{uses:r.actionRef("run-agent"),name:"Run agent",with:o}}function Ee(r){return{shell:"bash",...r}}var He="${{ github.event.issue.number }}",rn="${{ github.event.pull_request.number }}",Hn="${{ github.event.pull_request.head.sha }}",Yi="${{ github.event.pull_request.head.ref }}";function qe(r,e){let t=r.attrs.timeout;return typeof t=="number"?t:e}function In(r,e){let t=[],i=Tn(r);return i&&t.push(i),t.push(Nn(r,e)),t.push(Gi(r)),t}function Ot(r){let e=r.node,t=e.context??"issue",i=t==="pr-diff"||t==="pr-review",o=i?{contents:"read","pull-requests":"write"}:{contents:"read",issues:"write"},s=[],a=Tn(r);a&&s.push(a),s.push(Nn(r,i?{ref:Hn,fetchDepth:0}:void 0));let d=typeof e.attrs.gates=="string"?e.attrs.gates:void 0,u=i&&d?d.split(",").map(h=>h.trim()).filter(Boolean):[],c=u.map((h,g)=>Qr(`gate-${h}`,g,u));u.forEach((h,g)=>{s.push({uses:r.actionRef("wait-for-checks"),id:c[g],name:`Wait for ${h}`,with:{sha:Hn,"workflow-name":h,token:ue(r)}})}),s.push(je());let f=t==="pr-diff"?"pr-diff":t==="pr-review"?"pr-review":"issue";return s.push(tn(r,f,i?rn:He)),u.length&&s.push(Zr(u,c)),s.push(De(r,{withContext:!0})),{jobId:e.id,name:e.id,permissions:o,timeoutMinutes:qe(e,15+15*u.length),steps:s}}function Qr(r,e,t){let i=a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),o=i(r)||`gate-${e+1}`;return t.filter((a,d)=>d!==e&&i(`gate-${a}`)===o).length>0?`${o}-${e+1}`:o}function Zr(r,e){let t={CONTEXT_FILE:"${{ steps.ctx.outputs.context-file }}"},i=["{",' echo ""',' echo "=== CI GATES ==="'];return r.forEach((o,s)=>{t[`GATE_${s+1}_NAME`]=o,t[`GATE_${s+1}_RESULT`]=`\${{ steps.${e[s]}.outputs.conclusion }}`,i.push(` echo "$GATE_${s+1}_NAME: $GATE_${s+1}_RESULT"`)}),i.push(' echo ""',` echo "A gate whose result is not 'success' is a blocking finding: say which one"`,` echo "failed and request changes. 'timeout' or 'skipped' means CI never gave an"`,' echo "answer \u2014 treat it as unverified, not as a pass."','} >> "$CONTEXT_FILE"'),Ee({name:"Record CI gate results in the context",env:t,run:i.join(`
55
+ git config user.email "$GIT_EMAIL"`})}function tn(r,e,t){let i={type:e,number:t,token:ue(r)},o=r.config.identity?.bot_login;return o&&(i["trusted-authors"]=o),{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:i}}function De(r,e){let t=r.node,i=r.config,o={"role-file":Ne(r,t.files.role),model:i.agent.model,"comms-file":Ne(r,"agents/communication.md"),"scope-path":Ne(r,"agents/scope.yaml"),"claude-code-oauth-token":nn(i.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"),"github-token":ue(r)};e.withContext&&(o["context-file"]="${{ steps.ctx.outputs.context-file }}"),i.agent.conventions&&(o.conventions=i.agent.conventions);let s=typeof t.attrs.secrets=="string"?t.attrs.secrets.split(",").map(u=>u.trim()).filter(Boolean):[],a=[...new Set([...i.agent.secrets??[],...s])];a.length&&(o["extra-env"]=a.map(u=>`${u}=${nn(u)}`).join(`
56
+ `));let d=t.files.prompt;return d&&(o["prompt-override-file"]=Ne(r,d)),{uses:r.actionRef("run-agent"),name:"Run agent",with:o}}function Ee(r){return{shell:"bash",...r}}var He="${{ github.event.issue.number }}",rn="${{ github.event.pull_request.number }}",Hn="${{ github.event.pull_request.head.sha }}",Yi="${{ github.event.pull_request.head.ref }}";function qe(r,e){let t=r.attrs.timeout;return typeof t=="number"?t:e}function In(r,e){let t=[],i=Tn(r);return i&&t.push(i),t.push(Nn(r,e)),t.push(Gi(r)),t}function Ot(r){let e=r.node,t=e.context??"issue",i=t==="pr-diff"||t==="pr-review",o=i?{contents:"read","pull-requests":"write"}:{contents:"read",issues:"write"},s=[],a=Tn(r);a&&s.push(a),s.push(Nn(r,i?{ref:Hn,fetchDepth:0}:void 0));let d=typeof e.attrs.gates=="string"?e.attrs.gates:void 0,u=i&&d?d.split(",").map(h=>h.trim()).filter(Boolean):[],c=u.map((h,g)=>Qr(`gate-${h}`,g,u));u.forEach((h,g)=>{s.push({uses:r.actionRef("wait-for-checks"),id:c[g],name:`Wait for ${h}`,with:{sha:Hn,"workflow-name":h,token:ue(r)}})}),s.push(je());let f=t==="pr-diff"?"pr-diff":t==="pr-review"?"pr-review":"issue";return s.push(tn(r,f,i?rn:He)),u.length&&s.push(Zr(u,c)),s.push(De(r,{withContext:!0})),{jobId:e.id,name:e.id,permissions:o,timeoutMinutes:qe(e,15+15*u.length),steps:s}}function Qr(r,e,t){let i=a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),o=i(r)||`gate-${e+1}`;return t.filter((a,d)=>d!==e&&i(`gate-${a}`)===o).length>0?`${o}-${e+1}`:o}function Zr(r,e){let t={CONTEXT_FILE:"${{ steps.ctx.outputs.context-file }}"},i=["{",' echo ""',' echo "=== CI GATES ==="'];return r.forEach((o,s)=>{t[`GATE_${s+1}_NAME`]=o,t[`GATE_${s+1}_RESULT`]=`\${{ steps.${e[s]}.outputs.conclusion }}`,i.push(` echo "$GATE_${s+1}_NAME: $GATE_${s+1}_RESULT"`)}),i.push(' echo ""',` echo "A gate whose result is not 'success' is a blocking finding: say which one"`,` echo "failed and request changes. 'timeout' or 'skipped' means CI never gave an"`,' echo "answer \u2014 treat it as unverified, not as a pass."','} >> "$CONTEXT_FILE"'),Ee({name:"Record CI gate results in the context",env:t,run:i.join(`
57
57
  `)})}function eo(r){let e=r.node,t=r.config,i=In(r);return i.push(Ee({id:"branch",name:"Create branch",env:{ISSUE_NUMBER:He,ISSUE_TITLE:"${{ github.event.issue.title }}",PREFIX:t.repo.branch_prefix},run:[`SLUG=$(printf '%s' "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-50 | sed 's/-$//')`,'BRANCH="$PREFIX$ISSUE_NUMBER-$SLUG"','git checkout -b "$BRANCH"','echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"'].join(`
58
58
  `)})),i.push(je()),i.push(tn(r,"issue",He)),i.push(De(r,{withContext:!0})),i.push({uses:r.actionRef("agent-fallback"),name:"Fallback: commit / push / PR",if:"${{ !cancelled() }}",with:{branch:"${{ steps.branch.outputs.branch }}",token:ue(r),"agent-name":e.id,"base-branch":t.repo.base_branch,"issue-number":He,"pr-title":"${{ github.event.issue.title }}","pr-body":`### \u{1F6E0}\uFE0F Auto-created (fallback)
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegpvc/gp-foundry",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Compile a directed-graph spec (harness.dot) into an autonomous GitHub Actions agent harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,6 +43,7 @@ Rules of thumb:
43
43
  | `gates="ci.yml,..."` | `pr-review` | named check workflows the review depends on; each conclusion is put in front of the reviewer, and the job timeout grows to cover the waits |
44
44
  | `max_attempts=N` | `pr-fix` | loop bound; pairs with an `attempts>=N` escape edge. Counted from the reviewer's submitted request-changes reviews, which cannot be deleted |
45
45
  | `paths="memory/"` | `scheduled-agent` | optional allowlist of prefixes this lane may write; anything else is reverted before the push |
46
+ | `secrets="A,B"` | agent types | extra Actions secrets exposed to THIS lane's env (unioned with global `agent.secrets`); least-privilege scoping, e.g. a Sentry token only on the sweeper |
46
47
  | `policy="policy/merge.yaml"` | `merge-gate` | merge-policy file |
47
48
  | `schedule="*/30 * * * *"` | `merge-gate`, sweeps | cron cadence |
48
49
  | `environment=NAME` | `human-gate` | GitHub Environment gating approval (**required** on human-gate) |