@tocca-systems/twp-cli 0.61.0 → 0.62.0
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/CHANGELOG.public.md +10 -0
- package/dist/{agent-VNXVD6RC.js → agent-TLKSUAYA.js} +1 -1
- package/dist/{agent-loop-DFTHXSGN.js → agent-loop-SWXPY3OD.js} +2 -2
- package/dist/{ai-dispatch-M42S3SLX.js → ai-dispatch-EEX3FOFD.js} +3 -12
- package/dist/{analysis-QKYJFPGB.js → analysis-XO3WRAJR.js} +2 -2
- package/dist/{announcement-VIPUV4NC.js → announcement-LNG32J6X.js} +1 -1
- package/dist/{api-command-IYHQGTP7.js → api-command-G2TNSWKE.js} +3 -3
- package/dist/{app-CMD2HLDN.js → app-AOB26ORS.js} +2 -2
- package/dist/{attendance-correct-QYUMTKPG.js → attendance-correct-3C2BHJQG.js} +1 -1
- package/dist/{attendance-lists-JDQX4GIC.js → attendance-lists-VMOIE3XO.js} +1 -1
- package/dist/{backlog-SX2RXF7V.js → backlog-D5LZIEN4.js} +1 -1
- package/dist/{budget-NKSYQOBP.js → budget-RENLLCYQ.js} +1 -1
- package/dist/{chunk-HAA3YDV2.js → chunk-2B7A3OY7.js} +26 -18
- package/dist/{chunk-SDNASQZL.js → chunk-3WFZOOXZ.js} +1 -1
- package/dist/{chunk-I6WZ65SY.js → chunk-3YG7EN3Y.js} +1 -1
- package/dist/{chunk-LOTNN4VY.js → chunk-4PROMNXI.js} +1 -1
- package/dist/{chunk-K7WIC5SH.js → chunk-52V2AZ7D.js} +1 -1
- package/dist/{chunk-ZQG4IEBX.js → chunk-7LFYDASU.js} +2 -2
- package/dist/{chunk-EOYQ56LM.js → chunk-BZJJAJGN.js} +1 -1
- package/dist/{chunk-TRNS45SB.js → chunk-CSXCHRYE.js} +1 -1
- package/dist/{chunk-XWJVDNYE.js → chunk-DLD736A2.js} +1 -1
- package/dist/chunk-DXUFECE7.js +13 -0
- package/dist/{chunk-BVREBTDJ.js → chunk-E3KMIBSP.js} +1 -1
- package/dist/{chunk-CX56K7NH.js → chunk-EO3M43TN.js} +1 -1
- package/dist/{chunk-7OPBZYIZ.js → chunk-EWRZ4GSN.js} +2 -2
- package/dist/chunk-H4CDX4TX.js +9 -0
- package/dist/{chunk-5UJD2E2T.js → chunk-HEQCEFAW.js} +1 -1
- package/dist/{chunk-2N4JNFMB.js → chunk-LMYOCAEY.js} +1 -1
- package/dist/{chunk-VELLV6DJ.js → chunk-MYWDL3WX.js} +1 -1
- package/dist/{chunk-27BLHO7A.js → chunk-NXWXTUU6.js} +1 -1
- package/dist/chunk-QEWCTKPV.js +15 -0
- package/dist/{chunk-DCMIATYI.js → chunk-SLD6FCXA.js} +1 -1
- package/dist/{chunk-JDLYOCH7.js → chunk-T4YEQWJO.js} +2 -2
- package/dist/{chunk-O7XM54CL.js → chunk-T5CRU4DB.js} +1 -1
- package/dist/{chunk-KZHVWTZB.js → chunk-WBSAJ3P2.js} +1 -1
- package/dist/chunk-YNRONUTZ.js +10 -0
- package/dist/cli.js +8 -8
- package/dist/{commands-5E6DNXCQ.js → commands-RCCF5ZRU.js} +37 -34
- package/dist/{commands-EYEMPZJX.js → commands-WIQVCMQE.js} +1 -1
- package/dist/{company-MM7RMYG3.js → company-F3IGQMOJ.js} +3 -3
- package/dist/{contract-542CVLOG.js → contract-OWR27GIO.js} +2 -2
- package/dist/{department-ONWETRFN.js → department-3QDHMZ5P.js} +1 -1
- package/dist/{deposit-Q2LJYA2P.js → deposit-IPYESXIQ.js} +1 -1
- package/dist/{estimate-QG7UDIXA.js → estimate-4P67OZWB.js} +3 -3
- package/dist/{evaluation-VHYRW3OL.js → evaluation-ZA23GR7P.js} +1 -1
- package/dist/{expense-M6CDGLYD.js → expense-GEOAM7B3.js} +1 -1
- package/dist/{inquiry-LPATWSTM.js → inquiry-3SCMJOEM.js} +1 -1
- package/dist/{invoice-NMEPTMJ2.js → invoice-ONTG53HY.js} +2 -2
- package/dist/{job-title-2BITEYIJ.js → job-title-OQQH5W6C.js} +1 -1
- package/dist/{knowledge-WWRF6C7K.js → knowledge-IX7AZIBJ.js} +2 -2
- package/dist/{leave-TDXLDGQB.js → leave-7HMMZPCR.js} +2 -2
- package/dist/{logout-guard-HZLNYFXC.js → logout-guard-GQBF3GQH.js} +1 -1
- package/dist/{media-XAZAIWBW.js → media-GAL5WENN.js} +2 -2
- package/dist/{notification-2YYO4OOJ.js → notification-ZT23M4R6.js} +1 -1
- package/dist/{onedrive-UBSHXVYS.js → onedrive-ZY3GTU26.js} +1 -1
- package/dist/{oneshot-VS52YK26.js → oneshot-4NIS4J4S.js} +1 -1
- package/dist/{outlook-ODZD27J5.js → outlook-AAS5DXYQ.js} +1 -1
- package/dist/{position-2KKBZTPJ.js → position-HWBHYAD2.js} +1 -1
- package/dist/{project-AYQUMBJD.js → project-3ROID2HA.js} +1 -1
- package/dist/{prospect-MW4URE6T.js → prospect-7B5UWFLH.js} +2 -2
- package/dist/{purchase-IJCP43IQ.js → purchase-QVINV4TM.js} +3 -3
- package/dist/{receivable-PD3KXJA5.js → receivable-66MYAIVR.js} +1 -1
- package/dist/{registry-TK2MYRQ7.js → registry-JABWR2GZ.js} +1 -1
- package/dist/{report-3LW27YHM.js → report-XFTM4GCX.js} +1 -1
- package/dist/{run-ODEOVAS4.js → run-5COXNYKX.js} +2 -2
- package/dist/{sales-ai-review-ISVBOO3X.js → sales-ai-review-IVRISSWX.js} +2 -2
- package/dist/{sales-master-EPMRXFKQ.js → sales-master-BGVF2AZL.js} +2 -2
- package/dist/{sales-numbering-U6DSHKKM.js → sales-numbering-4423JWN6.js} +1 -1
- package/dist/{search-LU5ELPON.js → search-TMROBRYD.js} +1 -1
- package/dist/{server-settings-EINXR7SK.js → server-settings-3YD7RR3A.js} +1 -1
- package/dist/{setup-QJAHEDFF.js → setup-U22KITRG.js} +1 -1
- package/dist/{skill-OAUTVWTM.js → skill-S7EPMW5Z.js} +1 -1
- package/dist/{supplier-payment-OYIOW7NR.js → supplier-payment-O7GZSKGD.js} +2 -2
- package/dist/{support-JG43SGOY.js → support-U3VY5JI5.js} +1 -1
- package/dist/{task-XY3SVQJS.js → task-EQBPQ7H4.js} +3 -3
- package/dist/{teams-5EXL65HN.js → teams-GPJ6HMIX.js} +1 -1
- package/dist/{user-C2M3K236.js → user-XYUB54QT.js} +2 -2
- package/dist/{worker-agent-QREMLOKU.js → worker-agent-VPRWBAWG.js} +1 -1
- package/dist/{workflow-YKVB5A6Y.js → workflow-GMP6W5EF.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2RKT352P.js +0 -10
- package/dist/chunk-OLASZWF5.js +0 -13
- package/dist/chunk-QBGEYQ2I.js +0 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,promptSection}from"./chunk-S5DEP2HA.js";import{InstanceLock,buildLockOwner,defaultIsLoopProcess,writeLockOwner}from"./chunk-3WHC4FSG.js";import{LoopSettingsApplier,renderStepBudget}from"./chunk-
|
|
4
|
-
import{ServerSkillCatalog,formatSkillOrigins}from"./chunk-MPEHKAAL.js";import"./chunk-YJZT3UD3.js";import"./chunk-A4LFG7MW.js";import"./chunk-VRBI2NPI.js";import{duplicateTaskKeyDropReason,excludedKeyInArgs,extractPlanJson,parseOpsCount,parsePlanExcludeKeys,placeholderTaskKey,releaseDeployDropReason,stepToItem,zeroTargetDropReasons}from"./chunk-
|
|
5
|
-
localDate,loopStateDir,runHook,runPrefetch,runPreflight}from"./chunk-
|
|
6
|
-
import{ULID_RE,loopProjectIdPolicy,resolveProjectRef}from"./chunk-HVZUXLQ4.js";import{isTaskKey}from"./chunk-II5RVJQN.js";import"./chunk-VFPY2A23.js";import{joinFor}from"./chunk-PMOUHEJQ.js";import{AuthSession}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{compareVersionCores,parseVersionCore}from"./chunk-DXXFUNYN.js";import"./chunk-5WGOHFAS.js";
|
|
7
|
-
twpHomeDir}from"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs10 from"fs";import path8 from"path";import fs from"fs";import path from"path";var LoopLogger=class{constructor(runnerId,logFile,out=process.stdout,now=()=>new Date){this.runnerId=runnerId;this.out=out;this.now=now;if(logFile){fs.mkdirSync(path.dirname(logFile),{recursive:true});this.stream=fs.createWriteStream(logFile,{flags:"a"})}}runnerId;out;now;stream=null;log(message){const d=this.now();const ts=`${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;const line=`[${ts}] [${this.runnerId}] ${stripTerminalControls(
|
|
3
|
+
import{ScheduleApi,collectDue,gateStatus,nowInZone,parseCounts,promptSection}from"./chunk-S5DEP2HA.js";import{InstanceLock,buildLockOwner,defaultIsLoopProcess,writeLockOwner}from"./chunk-3WHC4FSG.js";import{LoopSettingsApplier,renderStepBudget}from"./chunk-NXWXTUU6.js";import{EngineNotConfiguredError,NoopEngine,UnknownEngineError,aiUnavailableLabel,assertKnownEngine,failureHint,isAiUnavailable,needsHumanToRestoreAi}from"./chunk-ZOOEH7ZE.js";import{claudeConfigDir,resolveDetectDeps}from"./chunk-T4QZO6RQ.js";
|
|
4
|
+
import{ServerSkillCatalog,formatSkillOrigins}from"./chunk-MPEHKAAL.js";import"./chunk-YJZT3UD3.js";import"./chunk-A4LFG7MW.js";import"./chunk-VRBI2NPI.js";import{duplicateTaskKeyDropReason,excludedKeyInArgs,extractPlanJson,parseOpsCount,parsePlanExcludeKeys,placeholderTaskKey,releaseDeployDropReason,stepToItem,zeroTargetDropReasons}from"./chunk-QEWCTKPV.js";import{CapacityReporter,buildLoopConfig,describeOperations,evaluateOwnership,evaluatePlanGate,exportStateDirEnv,
|
|
5
|
+
formatHookIds,formatHookWiring,localDate,loopStateDir,planGateStatePath,recordPlanned,runHook,runPrefetch,runPreflight}from"./chunk-2B7A3OY7.js";import"./chunk-DXUFECE7.js";import{exclusiveInflightEntries,formatExclusiveEntry,normalizeSkillName,skillOfItem,spawnSyncResolved}from"./chunk-AEJHDFXB.js";import{killProcessTree}from"./chunk-N2UVRM3Z.js";import{AgentLoopApi,describeError,filterByStatus,isPermanent,pick,pickString}from"./chunk-AT432SCP.js";import{PRIVATE_PROJECT_REF,
|
|
6
|
+
isPrivateProjectId,isPrivateProjectRef,privateProjectId,projectFileKey}from"./chunk-GY7KI5E5.js";import{ULID_RE,loopProjectIdPolicy,resolveProjectRef}from"./chunk-HVZUXLQ4.js";import{isTaskKey}from"./chunk-II5RVJQN.js";import"./chunk-VFPY2A23.js";import{joinFor}from"./chunk-PMOUHEJQ.js";import{AuthSession}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{compareVersionCores,parseVersionCore}from"./chunk-DXXFUNYN.js";import"./chunk-5WGOHFAS.js";
|
|
7
|
+
import{effectiveApiUrl,resolveProfile}from"./chunk-4VZKNEVN.js";import{twpHomeDir}from"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs10 from"fs";import path8 from"path";import fs from"fs";import path from"path";var LoopLogger=class{constructor(runnerId,logFile,out=process.stdout,now=()=>new Date){this.runnerId=runnerId;this.out=out;this.now=now;if(logFile){fs.mkdirSync(path.dirname(logFile),{recursive:true});this.stream=fs.createWriteStream(logFile,{flags:"a"})}}runnerId;out;now;stream=null;log(message){const d=this.now();const ts=`${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;const line=`[${ts}] [${this.runnerId}] ${stripTerminalControls(
|
|
8
8
|
message)}
|
|
9
9
|
`;this.out.write(line);this.stream?.write(line)}separator(){this.log("=".repeat(60))}close(){this.stream?.end();this.stream=null}};function pad(n){return String(n).padStart(2,"0")}function rotateLogs(dir,retentionDays,now=Date.now()){if(retentionDays<=0)return;const cutoff=now-retentionDays*864e5;let entries;try{entries=fs.readdirSync(dir)}catch{return}for(const name of entries){if(!/^(agent-loop|task-loop|step|plan|schedule-enqueued)-.*\.(log|txt)$/.test(name))continue;const file=path.join(dir,
|
|
10
10
|
name);try{if(fs.statSync(file).mtimeMs<cutoff)fs.rmSync(file,{force:true})}catch{}}}import fs7 from"fs";import path5 from"path";var MAX_OUTCOME_DETAIL_LENGTH=1e3;function parseOutcomeDetail(logText){const matches=[...logText.matchAll(/\b[A-Z][A-Z0-9_]*_RESULT:[^\n]*/g)];const line=matches.at(-1)?.[0];if(line===void 0)return null;const sep=line.indexOf("|");if(sep<0)return null;const detail=line.slice(sep+1).split("|").map(s=>s.trim()).filter(s=>s!=="").join(" | ");return detail===""?null:detail.slice(0,MAX_OUTCOME_DETAIL_LENGTH)}var str=v=>typeof v==="string"&&v!==""?v:null;function toRun(v){if(v===null||typeof v!=="obje\
|
|
@@ -181,7 +181,7 @@ api.update(itemId,rest,runId||this.config.runId);if(res.ok){fs6.rmSync(file,{for
|
|
|
181
181
|
var ABORT_DRAIN_TIMEOUT_MS=15e3;function lastContractLine(logText,line){const prefix=line!==null&&/^[A-Z][A-Z0-9_]*$/.test(line)?line:"[A-Z][A-Z0-9_]*_RESULT";return[...logText.matchAll(new RegExp(`^(?:${prefix}):[^\\n]*`,"gm"))].at(-1)?.[0]??""}var TaskLoop=class{constructor(deps){this.deps=deps;this.writeback=new Writeback(deps.api,deps.config,deps.log);this.schedule=new ScheduleBridge({config:deps.config,log:deps.log,api:new ScheduleApi(deps.api),fetchCount:async(key,statusId)=>{const{total,error}=await deps.
|
|
182
182
|
projectApi.countByStatus(deps.config.projectId,statusId);if(error){deps.log.log(` \u26A0\uFE0F require_zero\u300C${key}\u300D\u306E\u4EF6\u6570\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${error}\uFF09\u3002\u3053\u306E\u67A0\u306F\u767A\u706B\u3057\u307E\u305B\u3093\uFF08fail-closed\uFF09`)}const refined=await refineCount(key,total,deps.config.operations.countHooks,deps.config.workspace);if(refined.note)deps.log.log(` ${refined.note}`);return refined.total}});this.
|
|
183
183
|
engine=deps.engine;this.releaseLog=new ReleaseOutcomeLog(deps.config.releaseOutcomeLogPath);this.postDeps={api:deps.api,config:deps.config,log:deps.log,releaseLog:this.releaseLog};this.planLock=new PlanLock({api:deps.api,config:deps.config,log:deps.log,runner:deps.runner,hasPendingItems:async()=>await this.hasPendingItems()&&!this.nothingClaimableBacklog,reregister:async()=>{deps.runner.registered=false;await deps.runner.registerOrThrow()},...deps.sleepFn?{sleepFn:deps.sleepFn}:{}});this.trustGate=
|
|
184
|
-
deps.trustGate??new TrustGate({enabled:()=>deps.config.ai.usesAi("claude"),check:()=>checkWorkspaceTrust(deps.config.workspace,{launcherBin:deps.config.claudeLauncher.bin})});this.timestamp=new Date().toISOString().replace(/[-:]/g,"").replace(/\..*$/,"");this.settings=deps.settings??new LoopSettingsApplier({api:deps.api,config:deps.config,log:m=>deps.log.log(m)});this.skills=deps.skills??new ServerSkillCatalog({api:deps.api,config:deps.config,log:m=>deps.log.log(m)})}deps;writeback;schedule;planLock;engine;releaseLog;postDeps;timestamp;deferredIds=new Set;midcycleEnqueued=0;aborting=false;draining=false;nothingClaimableBacklog=false;drainExitCode=0;drainWaiters=new Set;itemInFlight=null;ownershipLostItemId=null;abortDrained=null;cyclePreflightSection="";trustGate;settings;skills;sleep(ms){
|
|
184
|
+
deps.trustGate??new TrustGate({enabled:()=>deps.config.ai.usesAi("claude"),check:()=>checkWorkspaceTrust(deps.config.workspace,{launcherBin:deps.config.claudeLauncher.bin})});this.timestamp=new Date().toISOString().replace(/[-:]/g,"").replace(/\..*$/,"");this.settings=deps.settings??new LoopSettingsApplier({api:deps.api,config:deps.config,log:m=>deps.log.log(m)});this.skills=deps.skills??new ServerSkillCatalog({api:deps.api,config:deps.config,log:m=>deps.log.log(m)})}deps;planGateFingerprint=null;lastPlanWasEmpty=false;writeback;schedule;planLock;engine;releaseLog;postDeps;timestamp;deferredIds=new Set;midcycleEnqueued=0;aborting=false;draining=false;nothingClaimableBacklog=false;drainExitCode=0;drainWaiters=new Set;itemInFlight=null;ownershipLostItemId=null;abortDrained=null;cyclePreflightSection="";trustGate;settings;skills;sleep(ms){
|
|
185
185
|
return(this.deps.sleepFn??sleep)(ms)}sleepUnlessDraining(ms){if(this.draining)return Promise.resolve();return new Promise(resolve=>{let timer=null;let settled=false;const wake=()=>{if(settled)return;settled=true;if(timer!==null)clearTimeout(timer);this.drainWaiters.delete(wake);resolve()};this.drainWaiters.add(wake);const injected=this.deps.sleepFn;if(injected)void injected(ms).then(wake);else timer=setTimeout(wake,ms)})}requestDrain(reason,exitCode=0){if(this.draining)return;this.draining=true;
|
|
186
186
|
this.drainExitCode=exitCode;const running=this.itemInFlight;const why=reason.trim()===""?"\u7406\u7531\u4E0D\u660E":reason;this.deps.log.log(running===null?`\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u53D6\u308A\u307E\u3057\u305F\uFF08${why}\uFF09\u3002\u5B9F\u884C\u4E2D\u306E\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u30A2\u30A4\u30C6\u30E0\u3092\u53D6\u3089\u305A\u306B\u7D42\u4E86\u3057\u307E\u3059\u3002`:`\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u53D6\u308A\u307E\u3057\u305F\uFF08${why}\
|
|
187
187
|
\uFF09\u3002\u5B9F\u884C\u4E2D\u306E\u30A2\u30A4\u30C6\u30E0\uFF08${running}\uFF09\u3092\u5B8C\u8D70\u3055\u305B\u3066\u304B\u3089\u7D42\u4E86\u3057\u307E\u3059\u3002`);const waiters=[...this.drainWaiters];this.drainWaiters.clear();for(const w of waiters)w()}cooldownNote(outcome){if(outcome!=="rate-limited")return"";const remaining=this.deps.config.ai.minCooldownRemainingSec();return remaining===null?"":`\uFF08\u6700\u77ED\u306E\u89E3\u9664\u307E\u3067\u7D04${remaining}\u79D2\uFF09`}startOwnershipWatch(itemId){
|
|
@@ -193,29 +193,30 @@ resolve()},ABORT_DRAIN_TIMEOUT_MS);timer.unref?.()})]);if(timer!==null)clearTime
|
|
|
193
193
|
if(!config.planEnabled){log.log("\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u306F\u7121\u52B9\u3067\u3059\uFF08plan_enabled=false\uFF09\u3002\u30AD\u30E5\u30FC\u304C\u7A7A\u3067\u3082\u8A08\u753BAI\u3092\u8D77\u52D5\u305B\u305A\u3001\u7A4D\u307E\u308C\u305F\u4ED5\u4E8B\u306E\u5B9F\u884C\u3060\u3051\u3092\u884C\u3044\u307E\u3059\u3002")}let cycle=0;let noProgressStreak=0;let unavailableStreak=0;let undeterminedStreak=0;let exitCode=0;while(cycle<config.maxCycles){if(this.aborting){log.log("\u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u3092\u53D7\u3051\u3066\u3044\u308B\
|
|
194
194
|
\u305F\u3081\u3001\u65B0\u3057\u3044\u30B5\u30A4\u30AF\u30EB\u3092\u958B\u59CB\u3057\u307E\u305B\u3093\u3002");break}if(this.draining){log.log(`\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u3066\u3044\u308B\u305F\u3081\u3001\u65B0\u3057\u3044\u30B5\u30A4\u30AF\u30EB\u3092\u958B\u59CB\u3057\u307E\u305B\u3093\uFF08\u7D42\u4E86\u30B3\u30FC\u30C9 ${this.drainExitCode}\uFF09\u3002`);exitCode=this.drainExitCode;break}cycle+=1;const cycleStart=Date.now();log.separator();log.log(`========== Cy\
|
|
195
195
|
cle ${cycle}${config.daemon?"":`/${config.maxCycles}`} \u958B\u59CB ==========`);log.separator();await runner.beat("idle");log.log(formatHookWiring(config.prefetch,config.preflight));if(config.preflight.length>0){log.log(`\u74B0\u5883\u306E\u524D\u63D0\u6761\u4EF6\u3092\u78BA\u8A8D\u4E2D\uFF08\u30D5\u30C3\u30AF ${config.preflight.length}\u4EF6\uFF09...`)}this.cyclePreflightSection=await runPreflight(config.preflight,config.workspace,m=>log.log(m));await this.settings.apply();await this.skills.refresh();
|
|
196
|
-
try{await this.engine.healthCheck?.({cwd:config.workspace,logFilePrefix:path5.join(config.logDir,`health-${this.timestamp}-${cycle}`)})}catch(err){log.log(` \u26A0\uFE0F AI\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${err.message}\uFF09\u3002\u9396\u306F\u305D\u306E\u307E\u307E\u4F7F\u3044\u307E\u3059`)}for(const line of normalizeGitIdentity(config.workspace,config.gitIdentity).logs)log.log(line);let planSkippedNoLock=false;
|
|
197
|
-
writeback.retryPending();for(const itemId of resent)await this.schedule.recordByItem(itemId,"completed");const reclaimRes=await this.deps.api.reclaim();if(!reclaimRes.ok){log.log(` \u26A0\uFE0F \u6B7B\u3093\u3060\u30E9\u30F3\u30CA\u30FC\u306E\u30A2\u30A4\u30C6\u30E0\u56DE\u53CEAPI\u304C\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${describeError(reclaimRes)}\uFF09\u3002\u53D6\u308A\u6B8B\u3057\u304C\u6B8B\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059`)}await this.reclaimStaleProcessing();
|
|
196
|
+
try{await this.engine.healthCheck?.({cwd:config.workspace,logFilePrefix:path5.join(config.logDir,`health-${this.timestamp}-${cycle}`)})}catch(err){log.log(` \u26A0\uFE0F AI\u30D8\u30EB\u30B9\u30C1\u30A7\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${err.message}\uFF09\u3002\u9396\u306F\u305D\u306E\u307E\u307E\u4F7F\u3044\u307E\u3059`)}for(const line of normalizeGitIdentity(config.workspace,config.gitIdentity).logs)log.log(line);let planSkippedNoLock=false;let planSkippedNoChange=false;
|
|
197
|
+
const resent=await this.writeback.retryPending();for(const itemId of resent)await this.schedule.recordByItem(itemId,"completed");const reclaimRes=await this.deps.api.reclaim();if(!reclaimRes.ok){log.log(` \u26A0\uFE0F \u6B7B\u3093\u3060\u30E9\u30F3\u30CA\u30FC\u306E\u30A2\u30A4\u30C6\u30E0\u56DE\u53CEAPI\u304C\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${describeError(reclaimRes)}\uFF09\u3002\u53D6\u308A\u6B8B\u3057\u304C\u6B8B\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059`)}await this.reclaimStaleProcessing();
|
|
198
198
|
const trust=this.trustGate.evaluate();for(const line of trust.logs)log.log(line);if(trust.note!==null){this.cyclePreflightSection=this.cyclePreflightSection===""?trust.note:`${this.cyclePreflightSection}
|
|
199
199
|
|
|
200
200
|
${trust.note}`}if(trust.wait){await runner.beat("waiting");if(cycle<config.maxCycles)await this.sleepUnlessDraining(config.intervalSec*1e3);continue}const pendingListed=await this.hasPendingItems();const hadPending=pendingListed&&!this.nothingClaimableBacklog;if(pendingListed&&!hadPending){log.log("pending \u306F\u3053\u306E\u6A5F\u4F53\u304C\u53D6\u308C\u306A\u3044\u3082\u306E\uFF08\u524D\u63D0\u672A\u5145\u8DB3\u30FB\u5225\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u5C02\u7528\uFF09\u3060\u3051\u3067\u3059\uFF08\u524D\u56DE\u306E claim \u306E\u5224\u5B9A\uFF09\u3002\u30AD\u30E5\u30FC\u304C\u7A7A\u306E\u3068\u304D\u3068\u540C\u3058\u304F\u8A08\u753B\u3057\u307E\u3059\u3002")}
|
|
201
201
|
this.midcycleEnqueued=0;this.deferredIds=new Set;await this.enqueueDueScheduled(false);const planSkippedDisabled=!hadPending&&(!config.planEnabled||config.operations.planSkill===null);if(hadPending){log.log("\u30AD\u30E5\u30FC\u306Bpending\u30A2\u30A4\u30C6\u30E0\u304C\u3042\u308A\u307E\u3059\u3002\u8A08\u753B\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3066\u5B9F\u884C\u306B\u9032\u307F\u307E\u3059\u3002")}else if(planSkippedDisabled){log.log(`\u30AD\u30E5\u30FC\u306F\u7A7A\u3067\u3059\u304C\u3001\u3053\u306E\u6A5F\u4F53\u306F\u8A08\u753B\u3092\u7ACB\u3066\u306A\u3044\u8A2D\u5B9A\u3067\u3059\uFF08${config.
|
|
202
|
-
planEnabled?"operations.plan_skill \u672A\u8A2D\u5B9A":"plan_enabled=false"}\uFF09\u3002AI \u3092\u8D77\u52D5\u305B\u305A\u30AD\u30E5\u30FC\u306E\u5B9F\u884C\u3078\u9032\u307F\u307E\u3059\u3002`)}else{log.log("\u30AD\u30E5\u30FC\u304C\u7A7A\u3067\u3059\u3002\u8A08\u753B\u3092\u7ACB\u6848\u3057\u3066\u30A8\u30F3\u30AD\u30E5\u30FC\u3057\u307E\u3059\u3002")}if(planSkippedDisabled){}else if(!hadPending&&this.draining){log.log("\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u3066\u3044\u308B\u305F\u3081\u3001\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u5B9F\u884C\u3057\u307E\u305B\u3093\u3002")}else if(!hadPending
|
|
203
|
-
const acquired=await this.planLock.acquire();if(acquired!=="acquired"){planSkippedNoLock=true;log.log("\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3066\u30AD\u30E5\u30FC\u306E\u5B9F\u884C\u3078\u9032\u307F\u307E\u3059\u3002")}else{
|
|
204
|
-
if(planResult==="aborted"){log.log("\u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u306B\u3088\u308A\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u6253\u3061\u5207\u308A\u307E\u3057\u305F\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002");
|
|
205
|
-
)`);log.log(` ${AI_RECOVERY_HINT}`);if(unavailableStreak>=3){exitCode=1;log.log("\u26D4 AI \u30921\u3064\u3082\u8D77\u52D5\u3067\u304D\u306A\u3044\u72B6\u614B\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\uFF08\u7D42\u4E86\u30B3\u30FC\u30C91\uFF09");
|
|
206
|
-
break}}else{unavailableStreak=0;log.log(`\u26A0\uFE0F ${aiUnavailableLabel(planResult)}\u3067\u8A08\u753B\u3067\u304D\u307E\u305B\u3093${this.cooldownNote(planResult)}\uFF08\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\u30FB\u6B21\u30B5\u30A4\u30AF\u30EB\u3067\u518D\u5224\u5B9A\uFF09`)}
|
|
207
|
-
if(config.daemon){log.log(`\u30C7\u30FC\u30E2\u30F3\u30E2\u30FC\u30C9\u306E\u305F\u3081 ${config.intervalSec}\u79D2\u5F8C\u306B\u30EA\u30C8\u30E9\u30A4...`);await runner.beat("waiting");await this.sleepUnlessDraining(config.intervalSec*1e3);continue}break}}}const outcome=await this.
|
|
208
|
-
\u30A4\u30C6\u30E0\u306F\u5B8C\u8D70\u6E08\u307F\u30FB\u7D42\u4E86\u30B3\u30FC\u30C9 ${this.drainExitCode}\uFF09\u3002`:"/stop \u30B3\u30DE\u30F3\u30C9\u306B\u3088\u308A\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002");
|
|
209
|
-
unexecuted>0&&outcome.needsHuman){undeterminedStreak=0;
|
|
210
|
-
\u4EF6\u3092\
|
|
211
|
-
emptyQueue&&planSkippedDisabled){undeterminedStreak=0;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u8A08\u753B\u3092\u7ACB\u3066\u306A\u3044\u8A2D\u5B9A\u3067\u30AD\u30E5\u30FC\u3082\u7A7A\u3067\u3057\u305F\uFF08\u5F85\u6A5F\u30FB\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\uFF09`)}else if(outcome.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
202
|
+
planEnabled?"operations.plan_skill \u672A\u8A2D\u5B9A":"plan_enabled=false"}\uFF09\u3002AI \u3092\u8D77\u52D5\u305B\u305A\u30AD\u30E5\u30FC\u306E\u5B9F\u884C\u3078\u9032\u307F\u307E\u3059\u3002`)}else{log.log("\u30AD\u30E5\u30FC\u304C\u7A7A\u3067\u3059\u3002\u8A08\u753B\u3092\u7ACB\u6848\u3057\u3066\u30A8\u30F3\u30AD\u30E5\u30FC\u3057\u307E\u3059\u3002")}if(planSkippedDisabled){}else if(!hadPending&&this.draining){log.log("\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u3066\u3044\u308B\u305F\u3081\u3001\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u5B9F\u884C\u3057\u307E\u305B\u3093\u3002")}else if(!hadPending&&
|
|
203
|
+
await this.planGateSaysSkip()){planSkippedNoChange=true;log.log("\u8A08\u753B\u306E AI \u3092\u8D77\u52D5\u305B\u305A\u30AD\u30E5\u30FC\u306E\u5B9F\u884C\u3078\u9032\u307F\u307E\u3059\uFF08\u5165\u529B\u306B\u5909\u5316\u306A\u3057\uFF09\u3002")}else if(!hadPending){const acquired=await this.planLock.acquire();if(acquired!=="acquired"){planSkippedNoLock=true;log.log("\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3066\u30AD\u30E5\u30FC\u306E\u5B9F\u884C\u3078\u9032\u307F\u307E\u3059\u3002")}else{
|
|
204
|
+
await runner.beat("plan");this.planLock.startRenewWorker();let planResult="failed";try{planResult=await this.runPlanAndEnqueue(cycle)}finally{await this.planLock.release(planResult==="ok"?"completed":"failed");this.planLock.reportIfLost()}if(planResult==="ok"&&this.lastPlanWasEmpty)this.recordPlanGateFingerprint();if(planResult==="aborted"){log.log("\u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u306B\u3088\u308A\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u3092\u6253\u3061\u5207\u308A\u307E\u3057\u305F\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002");
|
|
205
|
+
break}if(planResult!=="ok"&&isAiUnavailable(planResult)){undeterminedStreak=0;if(needsHumanToRestoreAi(planResult)){noProgressStreak+=1;unavailableStreak+=1;log.log(`\u26D4 ${aiUnavailableLabel(planResult)}\u305F\u3081\u8A08\u753B\u3067\u304D\u307E\u305B\u3093 (\u9023\u7D9A: ${unavailableStreak})`);log.log(` ${AI_RECOVERY_HINT}`);if(unavailableStreak>=3){exitCode=1;log.log("\u26D4 AI \u30921\u3064\u3082\u8D77\u52D5\u3067\u304D\u306A\u3044\u72B6\u614B\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\uFF08\u7D42\u4E86\u30B3\u30FC\u30C91\uFF09");
|
|
206
|
+
log.log(" **\u518D\u30ED\u30B0\u30A4\u30F3\uFF0F\u30C8\u30FC\u30AF\u30F3\u6295\u5165\u307E\u3067\u518D\u8D77\u52D5\u3057\u3066\u3082\u540C\u3058\u7D50\u679C\u306B\u306A\u308A\u307E\u3059**");break}}else{unavailableStreak=0;log.log(`\u26A0\uFE0F ${aiUnavailableLabel(planResult)}\u3067\u8A08\u753B\u3067\u304D\u307E\u305B\u3093${this.cooldownNote(planResult)}\uFF08\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\u30FB\u6B21\u30B5\u30A4\u30AF\u30EB\u3067\u518D\u5224\u5B9A\uFF09`)}
|
|
207
|
+
if(cycle<config.maxCycles){await runner.beat("waiting");await this.sleepUnlessDraining(config.intervalSec*1e3)}continue}if(planResult!=="ok"){log.log("\u8A08\u753B\u30D5\u30A7\u30FC\u30BA\u304C\u5931\u6557\u3057\u307E\u3057\u305F");if(config.daemon){log.log(`\u30C7\u30FC\u30E2\u30F3\u30E2\u30FC\u30C9\u306E\u305F\u3081 ${config.intervalSec}\u79D2\u5F8C\u306B\u30EA\u30C8\u30E9\u30A4...`);await runner.beat("waiting");await this.sleepUnlessDraining(config.intervalSec*1e3);continue}break}}}const outcome=await this.
|
|
208
|
+
runDequeueLoop(cycle);if(outcome.stop){log.log(this.aborting?"\u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u306B\u3088\u308A\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002":this.draining?`\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u306B\u3088\u308A\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\uFF08\u5B9F\u884C\u4E2D\u306E\u30A2\u30A4\u30C6\u30E0\u306F\u5B8C\u8D70\u6E08\u307F\u30FB\u7D42\u4E86\u30B3\u30FC\u30C9 ${this.drainExitCode}\uFF09\u3002`:"/stop \u30B3\u30DE\u30F3\u30C9\u306B\u3088\u308A\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002");
|
|
209
|
+
if(this.draining)exitCode=this.drainExitCode;break}unavailableStreak=outcome.unexecuted>0&&outcome.needsHuman?unavailableStreak+1:0;if(outcome.progress){noProgressStreak=0;undeterminedStreak=0;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u9032\u6357\u3042\u308A`)}else if(outcome.unexecuted>0&&outcome.needsHuman){undeterminedStreak=0;noProgressStreak+=1;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: AI \u30921\u3064\u3082\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${outcome.unexecuted}\
|
|
210
|
+
\u4EF6\u3092\u30AD\u30E5\u30FC\u3078\u8FD4\u5374\u30FB\u9023\u7D9A: ${noProgressStreak}\uFF09`);log.log(` ${AI_RECOVERY_HINT}`)}else if(outcome.unexecuted>0){undeterminedStreak=0;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: AI \u5074\u306E\u90FD\u5408\u3067 ${outcome.unexecuted}\u4EF6\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${this.cooldownNote("rate-limited")}\uFF08\u30AD\u30E5\u30FC\u3078\u8FD4\u5374\u30FB\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\uFF09`)}else if(outcome.
|
|
211
|
+
deferred>0){log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u6642\u9593\u5E2F\u30B2\u30FC\u30C8\u3067\u5F85\u6A5F\u4E2D\uFF08${outcome.deferred}\u4EF6\u3092\u5F8C\u56DE\u3057\u30FB\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\uFF09`)}else if(outcome.emptyQueue&&planSkippedDisabled){undeterminedStreak=0;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u8A08\u753B\u3092\u7ACB\u3066\u306A\u3044\u8A2D\u5B9A\u3067\u30AD\u30E5\u30FC\u3082\u7A7A\u3067\u3057\u305F\uFF08\u5F85\u6A5F\u30FB\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\uFF09`)}else if(outcome.
|
|
212
|
+
emptyQueue&&planSkippedNoChange){undeterminedStreak=0;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u5165\u529B\u306B\u5909\u5316\u304C\u306A\u3044\u305F\u3081\u8A08\u753B\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u30AD\u30E5\u30FC\u3082\u7A7A\u3067\u3057\u305F\uFF08\u5F85\u6A5F\u30FB\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\uFF09`)}else if(outcome.emptyQueue&&planSkippedNoLock){undeterminedStreak=0;if(this.planLock.permanentFail&&this.planLock.failStreak>=config.planLockPermanentMax){
|
|
213
|
+
noProgressStreak+=1;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u8A08\u753B\u30ED\u30C3\u30AF\u306E\u53D6\u5F97\u304C\u6052\u4E45\u30A8\u30E9\u30FC\uFF084xx\uFF09\u3067 ${this.planLock.failStreak}\u30B5\u30A4\u30AF\u30EB\u9023\u7D9A\u3057\u3066\u3044\u307E\u3059`);log.log(` **\u518D\u8A66\u884C\u3067\u306F\u89E3\u6D88\u3057\u306A\u3044\u305F\u3081\u3001\u9032\u6357\u306A\u3057\u3068\u3057\u3066\u6570\u3048\u307E\u3059** (\u9023\u7D9A: ${noProgressStreak})`)}else{log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}\
|
|
214
|
+
: \u8A08\u753B\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u30AD\u30E5\u30FC\u3082\u7A7A\u3067\u3057\u305F\uFF08\u9023\u7D9A\u30AB\u30A6\u30F3\u30C8\u306F\u52A0\u7B97\u3057\u306A\u3044\u30FB\u6B21\u30B5\u30A4\u30AF\u30EB\u3067\u518D\u5224\u5B9A\uFF09`)}}else if(outcome.undetermined){undeterminedStreak+=1;log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u30AD\u30E5\u30FC\u306E\u72B6\u614B\u3092\u5224\u5B9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${undeterminedStreak}\u30B5\u30A4\u30AF\u30EB\u9023\u7D9A\u30FB\u9032\u6357\u306A\u3057\u306B\u306F\u6570\u3048\u306A\u3044\uFF09`);
|
|
215
|
+
if(undeterminedStreak>=config.queueUndeterminedMax){log.log(`\u26D4 claim API\u306E\u969C\u5BB3\u304C ${undeterminedStreak} \u30B5\u30A4\u30AF\u30EB\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\uFF08\u7D42\u4E86\u30B3\u30FC\u30C91\uFF09`);log.log(" \u78BA\u8A8D: API\u306E\u758E\u901A\uFF0F\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\uFF0F--project \u306E\u6307\u5B9A\u3002\u5FA9\u65E7\u5F8C\u306B\u518D\u8D77\u52D5\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
216
|
+
exitCode=1;break}}else{undeterminedStreak=0;noProgressStreak+=1;log.log(outcome.emptyQueue?`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u30AD\u30E5\u30FC\u304C\u7A7A\u3067\u3057\u305F (\u9023\u7D9A: ${noProgressStreak})`:`\u30B5\u30A4\u30AF\u30EB ${cycle}: \u9032\u6357\u306A\u3057 (\u9023\u7D9A: ${noProgressStreak})`)}log.log(`\u30B5\u30A4\u30AF\u30EB ${cycle} \u5B8C\u4E86 (duration: ${Math.trunc((Date.now()-cycleStart)/1e3)}s)`);if(noProgressStreak>=3){log.log("3\u30B5\u30A4\u30AF\u30EB\u9023\u7D9A\u3067\u9032\u6357\u306A\u3057\u3002\u30EB\u30FC\u30D7\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002");
|
|
217
|
+
if(unavailableStreak>=3){exitCode=1;log.log("\u26D4 \u539F\u56E0\u306F\u300CAI \u30921\u3064\u3082\u8D77\u52D5\u3067\u304D\u306A\u3044\u300D\u3053\u3068\u3067\u3059\uFF08\u672A\u30ED\u30B0\u30A4\u30F3\u7B49\uFF09\u3002");log.log(` ${AI_RECOVERY_HINT}`);log.log(" **\u8CC7\u683C\u60C5\u5831\u3092\u76F4\u3059\u307E\u3067\u518D\u8D77\u52D5\u3057\u3066\u3082\u540C\u3058\u7D50\u679C\u306B\u306A\u308A\u307E\u3059**")}if(this.planLock.permanentFail){log.log("\u26D4 \u539F\u56E0\u306F\u8A08\u753B\u30ED\u30C3\u30AFAPI\u306E\u6052\u4E45\u30A8\u30E9\u30FC\uFF084xx\uFF09\u3067\u3059\u3002**\u8A2D\u5B9A\u3092\u76F4\u3059\u307E\u3067\u518D\u8D77\u52D5\u3057\u3066\
|
|
218
|
+
\u3082\u540C\u3058\u7D50\u679C\u306B\u306A\u308A\u307E\u3059**");exitCode=1}break}if(cycle<config.maxCycles){log.log(`\u6B21\u30B5\u30A4\u30AF\u30EB\u307E\u3067 ${config.intervalSec}\u79D2 \u5F85\u6A5F...`);await runner.beat("waiting");await this.sleepUnlessDraining(config.intervalSec*1e3)}}log.separator();this.abortDrained?.();log.log("twp task-loop \u7D42\u4E86");log.log(` \u7DCF\u30B5\u30A4\u30AF\u30EB\u6570: ${cycle}`);log.log(` \u30ED\u30B0: ${config.logDir}`);log.separator();return exitCode}async hasPendingItems(){
|
|
219
|
+
const res=await this.deps.api.list({status:"pending",limit:1});if(!res.ok){this.deps.log.log(` \u26A0\uFE0F pending\u4EF6\u6570\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${describeError(res)}\uFF09\u3002\u5B89\u5168\u5074\u306B\u5012\u3057\u3066\u8A08\u753B\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059\u3002`);return true}const items=pick(res.json,"items");if(!Array.isArray(items)){this.deps.log.log(` \u26A0\uFE0F pending\u4EF6\u6570\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.
|
|
219
220
|
raw.slice(0,120)}\uFF09\u3002\u5B89\u5168\u5074\u306B\u5012\u3057\u3066\u8A08\u753B\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059\u3002`);return true}return filterByStatus(items,"pending").length>0}async reclaimStaleProcessing(){const{config,log,api}=this.deps;if(config.staleReclaimHours<=0)return;const floorH=staleFloorHours(config.aiTimeoutSec);let hours=config.staleReclaimHours;if(hours<floorH){log.log(` \u2139\uFE0F STALE_RECLAIM_HOURS=${hours}h \u306F\u6700\u9577\u5B9F\u884C\u6642\u9593(AI_TIMEOUT\xD72=${floorH}\
|
|
220
221
|
h)\u3092\u4E0B\u56DE\u308B\u305F\u3081 ${floorH}h \u3092\u4F7F\u3044\u307E\u3059`);hours=floorH}const thresholdMs=hours*36e5;const now=Date.now();const stale=[];let cursor;for(let page=0;page<50;page++){const res=await api.list({status:"processing",limit:200,cursor});if(!res.ok){log.log(` \u26A0\uFE0F stale processing \u306E\u8D70\u67FB\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${describeError(res)}\uFF09\u3002`);log.log(" \u53D6\u308A\u6B8B\u3057\u306E\u56DE\u53CE\u306F\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u884C\u308F\u308C\u3066\u3044\u307E\u305B\u3093");
|
|
221
222
|
return}const items=pick(res.json,"items");if(!Array.isArray(items)){log.log(` \u26A0\uFE0F stale processing \u306E\u4E00\u89A7\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.raw.slice(0,120)}\uFF09\u3002`);log.log(" \u53D6\u308A\u6B8B\u3057\u306E\u56DE\u53CE\u306F\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u884C\u308F\u308C\u3066\u3044\u307E\u305B\u3093");return}for(const it of filterByStatus(items,"processing")){if(it.runner_id)continue;
|
|
@@ -233,15 +234,17 @@ led \u3068\u3057\u3066\u8FD4\u3057\u307E\u305B\u3093**")}else{await this.schedul
|
|
|
233
234
|
scheduleId}] ${row.windowKey} \u2192 ${itemId}\uFF09`);log.log(" **\u30EA\u30FC\u30B9\u671F\u9650\u5F8C\u306B\u540C\u3058\u67A0\u304C\u518D\u6295\u5165\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059**\u3002\u5B9A\u671F\u67A0\u304C\u672C\u756A\u30EA\u30EA\u30FC\u30B9\u306A\u3089\u4E8C\u91CD\u5B9F\u884C\u306B\u306A\u308A\u307E\u3059")}if(exclusiveSkill!==null)exclusiveEnqueued.add(exclusiveSkill);enqueuedLines.push(`- [${row.priority}] ${row.label} \u2192 ${prompt}`);log.log(
|
|
234
235
|
` \u5B9A\u671F\u30A8\u30F3\u30AD\u30E5\u30FC: [${row.priority}] ${row.label} \u2192 ${prompt}`);count+=1}if(count>0){log.log(midcycle?`\u5B9A\u671F\u30B9\u30B1\u30B8\u30E5\u30FC\u30EB\uFF08\u4E2D\u9593\u5224\u5B9A\uFF09: ${count}\u4EF6\u3092\u30AD\u30E5\u30FC\u306B\u6295\u5165\u3057\u307E\u3057\u305F`:`\u5B9A\u671F\u30B9\u30B1\u30B8\u30E5\u30FC\u30EB: ${count}\u4EF6\u3092\u30AD\u30E5\u30FC\u306B\u6295\u5165\u3057\u307E\u3057\u305F`);this.midcycleEnqueued+=count}else if(!midcycle){log.log("\u5B9A\u671F\u30B9\u30B1\u30B8\
|
|
235
236
|
\u30E5\u30FC\u30EB: \u4ECA\u30B5\u30A4\u30AF\u30EB\u3067\u767A\u706B\u3057\u305F\u5B9A\u671F\u30BF\u30B9\u30AF\u306F\u3042\u308A\u307E\u305B\u3093")}if(!midcycle){const file=path5.join(this.deps.config.logDir,`schedule-enqueued-${this.timestamp}.txt`);try{fs7.mkdirSync(path5.dirname(file),{recursive:true});fs7.writeFileSync(file,enqueuedLines.join("\n"))}catch{}}}async maybeEnqueueDueMidcycle(){const res=await this.deps.api.reclaim();if(!res.ok){this.deps.log.log(` \u26A0\uFE0F \u6B7B\u3093\u3060\u30E9\u30F3\u30CA\u30FC\u306E\u30A2\u30A4\u30C6\u30E0\u56DE\u53CEAPI\u304C\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${describeError(
|
|
236
|
-
res)}\uFF09`)}if(this.midcycleEnqueued>=this.deps.config.scheduleMidcycleMax)return;await this.enqueueDueScheduled(true)}async
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
res)}\uFF09`)}if(this.midcycleEnqueued>=this.deps.config.scheduleMidcycleMax)return;await this.enqueueDueScheduled(true)}async planGateSaysSkip(){const{config,log}=this.deps;this.planGateFingerprint=null;const gate=config.operations.planGate;if(gate===null)return false;const decision=await evaluatePlanGate(gate,{cwd:config.workspace,statePath:planGateStatePath(config.stateDir,projectFileKey(config.projectId)),nowMs:Date.now()});log.log(` plan_gate: ${decision.reason}`);this.planGateFingerprint=
|
|
238
|
+
decision.fingerprint;return decision.skip}recordPlanGateFingerprint(){const{config,log}=this.deps;const fingerprint=this.planGateFingerprint;this.planGateFingerprint=null;if(fingerprint===null)return;const statePath=planGateStatePath(config.stateDir,projectFileKey(config.projectId));if(!recordPlanned(statePath,fingerprint,Date.now())){log.log(` \u26A0\uFE0F plan_gate: \u8A08\u753B\u6642\u306E\u6307\u7D0B\u3092 ${statePath} \u306B\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u6B21\u30B5\u30A4\u30AF\u30EB\u3082\u8A08\u753B\u3057\u307E\u3059\uFF09`)}}async runPlanAndEnqueue(cycle){
|
|
239
|
+
const{config,log}=this.deps;this.lastPlanWasEmpty=false;const planSkill=config.operations.planSkill;if(planSkill===null)return"failed";log.separator();log.log("Phase 1: \u8A08\u753B\u3092\u7ACB\u6848\u3057\u3066\u30AD\u30E5\u30FC\u306B\u683C\u7D0D...");log.separator();const planLogFile=path5.join(config.logDir,`plan-${this.timestamp}-${cycle}.log`);const enqueuedFile=path5.join(config.logDir,`schedule-enqueued-${this.timestamp}.txt`);const scheduleSection=await this.schedule.promptSection(enqueuedFile);
|
|
240
|
+
if(config.prefetch.length>0)log.log(`\u8A08\u753B\u7528\u30C7\u30FC\u30BF\u3092\u4E8B\u524D\u53D6\u5F97\u4E2D\uFF08\u30D5\u30C3\u30AF ${config.prefetch.length}\u4EF6\uFF09...`);const prefetchSection=await runPrefetch(config.prefetch,config.workspace,m=>log.log(m));const excludeKeys=parsePlanExcludeKeys(prefetchSection);if(excludeKeys.size>0){log.log(` \u8A08\u753B\u5019\u88DC\u304B\u3089\u5916\u3059\u30BF\u30B9\u30AF\uFF08\u672A\u56DE\u7B54\u306E\u8CEA\u554F\u3042\u308A\uFF09: ${[...excludeKeys].
|
|
241
|
+
sort().join(", ")}`)}const taskStatusSnapshot=parseTaskStatusSnapshot(prefetchSection);if(taskStatusSnapshot===null){log.log(" \u26A0\uFE0F prefetch \u306B OPS_TASK_STATUS \u30DE\u30FC\u30AB\u30FC\u304C\u3042\u308A\u307E\u305B\u3093");log.log(" \u300C\u524D\u56DE\u304C\u72B6\u614B\u3092\u9032\u3081\u305F\u5834\u5408\u306E\u518D\u6295\u5165\u6291\u6B62\u300D\u306F**\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u7121\u52B9**\u3067\u3059\uFF08\u6295\u5165\u306F\u6B62\u3081\u307E\u305B\u3093\uFF09")}else if(!taskStatusSnapshot.
|
|
239
242
|
complete){log.log(" \u26A0\uFE0F \u30BF\u30B9\u30AF\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u4E00\u90E8\u53D6\u5F97\u3067\u304D\u3066\u3044\u307E\u305B\u3093\uFF08complete=0\uFF09\u2192 \u518D\u6295\u5165\u6291\u6B62\u306F\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u7121\u52B9\u3067\u3059")}const outcomeReports=await fetchOutcomeReports(this.deps.api,config.outcomeSkills??[]);for(const w of outcomeStreakWarnings(outcomeReports))log.log(` \u26A0\uFE0F ${w}`);const outcomeSection=renderOutcomeSection(
|
|
240
243
|
outcomeReports);const result=await this.engine.run({prompt:buildPlanPrompt(config,planSkill,scheduleSection,prefetchSection,outcomeSection),promptPrefix:this.cyclePreflightSection,logFile:planLogFile,timeoutSec:config.planTimeoutSec,cwd:config.workspace,skill:normalizeSkillName(planSkill.replace(/^\//,"")),validate:output=>extractPlanJson(output)!==null});writeLogFile(planLogFile,result.output);if(result.outcome==="aborted"){log.log(" \u23F9 \u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u306B\u3088\u308A\u8A08\u753B\u3092\u6253\u3061\u5207\u308A\u307E\u3057\u305F");
|
|
241
244
|
return"aborted"}if(result.outcome!=="ok"){if(isAiUnavailable(result.outcome)){log.log(` \u23ED AI \u3092\u8D77\u52D5\u3067\u304D\u306A\u3044\u305F\u3081\u8A08\u753B\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08outcome=${result.outcome}\uFF09`);return result.outcome}log.log(` \u26D4 \u8A08\u753B\u306E\u5B9F\u884C\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08outcome=${result.outcome}\uFF09`);return"failed"}if(this.planLock.isLost()){log.log(` \u26D4 \u8A08\u753B\u4E2D\u306B\u8A08\u753B\u30ED\u30C3\u30AF\u3092\u5931\u3044\u307E\u3057\u305F\uFF08reason=${this.
|
|
242
|
-
planLock.lostReasonText()}\uFF09`);log.log(" **\u30A8\u30F3\u30AD\u30E5\u30FC\u3092\u4E2D\u6B62\u3057\u307E\u3059**\u3002\u8A08\u753B\u7D50\u679C\u306F\u7834\u68C4\u3057\u3001\u6B21\u30B5\u30A4\u30AF\u30EB\u3067\u53D6\u308A\u76F4\u3057\u307E\u3059");return"ok"}const plan=extractPlanJson(result.output);if(!plan||plan.steps.length===0){log.log("\u8A08\u753B\u306Bsteps\u304C\u3042\u308A\u307E\u305B\u3093");return"ok"}const verifyBacklog=parseOpsCount(prefetchSection,"
|
|
243
|
-
steps.filter(s=>(s.skill??"").trim()==="dev-verify").length;const releaseDeployDrop=releaseDeployDropReason(verifyBacklog,devVerifyPlanned);if(releaseDeployDrop!==null&&plan.steps.some(s=>normalizeSkillName(s.skill??"")==="release-deploy")){log.log(` release-deploy \u306F\u8A08\u753B\u304B\u3089\u9664\u5916\u3057\u307E\u3059\uFF08\u7A7A\u632F\u308A\u9632\u6B62\u30AC\u30FC\u30C9\uFF09: ${releaseDeployDrop}`)}const zeroTargetDrops=zeroTargetDropReasons(prefetchSection,
|
|
244
|
-
for(const[skill,reason]of zeroTargetDrops){if(plan.steps.some(s=>normalizeSkillName(s.skill??"")===skill)){log.log(` ${skill} \u306F\u8A08\u753B\u304B\u3089\u9664\u5916\u3057\u307E\u3059\uFF08\u5BFE\u8C61\u8AAD\u307F\u66FF\u3048\u9632\u6B62\u30AC\u30FC\u30C9\uFF09: ${reason}`)}}const processing=await this.deps.api.processingSnapshot();const inflightKeys=new Set;if(processing===null){log.log(" \u26A0\uFE0F \u51E6\u7406\u4E2D\u30A2\u30A4\u30C6\u30E0\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F");
|
|
245
|
+
planLock.lostReasonText()}\uFF09`);log.log(" **\u30A8\u30F3\u30AD\u30E5\u30FC\u3092\u4E2D\u6B62\u3057\u307E\u3059**\u3002\u8A08\u753B\u7D50\u679C\u306F\u7834\u68C4\u3057\u3001\u6B21\u30B5\u30A4\u30AF\u30EB\u3067\u53D6\u308A\u76F4\u3057\u307E\u3059");return"ok"}const plan=extractPlanJson(result.output);if(!plan||plan.steps.length===0){log.log("\u8A08\u753B\u306Bsteps\u304C\u3042\u308A\u307E\u305B\u3093");this.lastPlanWasEmpty=true;return"ok"}const verifyBacklog=parseOpsCount(prefetchSection,"\
|
|
246
|
+
verify");const devVerifyPlanned=plan.steps.filter(s=>(s.skill??"").trim()==="dev-verify").length;const releaseDeployDrop=releaseDeployDropReason(verifyBacklog,devVerifyPlanned);if(releaseDeployDrop!==null&&plan.steps.some(s=>normalizeSkillName(s.skill??"")==="release-deploy")){log.log(` release-deploy \u306F\u8A08\u753B\u304B\u3089\u9664\u5916\u3057\u307E\u3059\uFF08\u7A7A\u632F\u308A\u9632\u6B62\u30AC\u30FC\u30C9\uFF09: ${releaseDeployDrop}`)}const zeroTargetDrops=zeroTargetDropReasons(prefetchSection,
|
|
247
|
+
config.operations.zeroTargetGates);for(const[skill,reason]of zeroTargetDrops){if(plan.steps.some(s=>normalizeSkillName(s.skill??"")===skill)){log.log(` ${skill} \u306F\u8A08\u753B\u304B\u3089\u9664\u5916\u3057\u307E\u3059\uFF08\u5BFE\u8C61\u8AAD\u307F\u66FF\u3048\u9632\u6B62\u30AC\u30FC\u30C9\uFF09: ${reason}`)}}const processing=await this.deps.api.processingSnapshot();const inflightKeys=new Set;if(processing===null){log.log(" \u26A0\uFE0F \u51E6\u7406\u4E2D\u30A2\u30A4\u30C6\u30E0\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F");
|
|
245
248
|
log.log(" \u540C\u4E00\u30BF\u30B9\u30AF\u306E\u4E8C\u91CD\u7740\u624B\u30AC\u30FC\u30C9\u306F**\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u7121\u52B9**\u3067\u3059\uFF08\u6295\u5165\u306F\u6B62\u3081\u307E\u305B\u3093\uFF09")}else{const entries=inflightEntries(processing,new Date,inflightStaleHours(config.aiTimeoutSec));for(const entry of entries)inflightKeys.add(entry.key);if(entries.length>0){log.log(" \u4ED6\u30E9\u30F3\u30CA\u30FC\u304C\u51E6\u7406\u4E2D\u306E task_key\uFF08\u3053\u306E\u8A08\u753B\u304B\u3089\u306F\u9664\u5916\u3057\u307E\u3059\uFF09:");
|
|
246
249
|
for(const entry of entries)log.log(` - ${formatInflightEntry(entry)}`)}}let pendingCache=null;let pendingFetched=false;const pendingOnce=async()=>{if(!pendingFetched){pendingFetched=true;pendingCache=await this.deps.api.pendingSnapshot()}return pendingCache};let pendingKeys=null;let pendingKeysResolved=false;const queuedPendingKeys=async()=>{if(pendingKeysResolved)return pendingKeys;pendingKeysResolved=true;const pending=await pendingOnce();if(pending===null){log.log(" \u26A0\uFE0F pending \u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\
|
|
247
250
|
\u3093\u3067\u3057\u305F");log.log(" \u30AD\u30E5\u30FC\u5F85\u3061\u30AD\u30FC\u306E\u7A4D\u307F\u76F4\u3057\u6291\u6B62\u306F**\u3053\u306E\u30B5\u30A4\u30AF\u30EB\u7121\u52B9**\u3067\u3059\uFF08\u6295\u5165\u306F\u6B62\u3081\u307E\u305B\u3093\uFF09");return null}pendingKeys=new Set(pending.map(p=>(p.task_key??"").trim()).filter(k=>k!==""));return pendingKeys};let exclusiveQueued=null;let exclusiveFetched=false;const exclusiveInflight=async()=>{if(exclusiveFetched)return exclusiveQueued;exclusiveFetched=
|
|
@@ -329,12 +332,12 @@ const startedAtMs=now();let warned="";let done=false;const check=()=>{if(done)re
|
|
|
329
332
|
decision.key)return;warned=decision.key;handlers.onWarn(decision.reason);return}done=true;const recorded=writeRestartAttempt(opts.stateDir,opts.projectKey,{from:decision.from,to:decision.to,at:new Date(now()).toISOString()},opts.store);if(!recorded){handlers.onWarn(`\u518D\u8D77\u52D5\u8A18\u9332\u3092\u66F8\u3051\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${restartAttemptPath(opts.stateDir,opts.projectKey)}\uFF09\u3002\u540C\u3058\u7248\u30C9\u30EA\u30D5\u30C8\u304C\u89E3\u6D88\u3057\u306A\u3044\u5834\u5408\u3001\u518D\u8D77\u52D5\u3092\u7E70\u308A\u8FD4\u3059\u9632\u6CE2\u5824\u304C\u52B9\u304D\u307E\u305B\u3093`)}
|
|
330
333
|
handlers.onRestart({from:decision.from,to:decision.to})};const timer=setInterval(check,opts.intervalMs??DRIFT_POLL_MS);timer.unref?.();return{stop:()=>{done=true;clearInterval(timer)},check}}import fs9 from"fs";import path7 from"path";var POLL_MS=1e3;var MAX_STOP_BYTES=4096;var MAX_AT_LENGTH=64;function markerPath(lockDir2,kind){return path7.join(lockDir2,kind)}function requestMarker(lockDir2,kind,pid,deps={}){const target=markerPath(lockDir2,kind);const write=deps.writeFileSync??((p,d)=>fs9.writeFileSync(p,d,{flag:"wx",mode:384}));const now=deps.now??(()=>new Date);clearMarker(lockDir2,kind,deps);try{write(target,`${JSON.stringify({pid,at:now().toISOString()})}
|
|
331
334
|
`);return{ok:true}}catch(err){const e=err;return{ok:false,reason:e.code??"UNKNOWN"}}}function readMarker(lockDir2,kind,deps={}){const target=markerPath(lockDir2,kind);const read=deps.readFileSync??(p=>fs9.readFileSync(p,"utf8"));const size=deps.statSize??(p=>fs9.statSync(p).size);let raw;try{if(size(target)>MAX_STOP_BYTES)return null;raw=read(target)}catch{return null}if(raw.length>MAX_STOP_BYTES)return null;try{const parsed=JSON.parse(raw);if(typeof parsed!=="object"||parsed===null)return null;const pid=parsed.pid;const at=parsed.at;if(typeof pid!=="number"||!Number.isInteger(pid)||
|
|
332
|
-
pid<=0)return null;return{pid,at:sanitizeAt(at)}}catch{return null}}function sanitizeAt(at){if(typeof at!=="string")return"";return at.replace(/[\u0000-\u001f\u007f]/g," ").slice(0,MAX_AT_LENGTH)}function clearMarker(lockDir2,kind,deps={}){const rm=deps.rmSync??(p=>fs9.rmSync(p,{recursive:true,force:true}));try{rm(markerPath(lockDir2,kind))}catch{}}function watchMarker(lockDir2,kind,selfPid,onStop,deps={}){let fired=false;const timer=setInterval(()=>{if(fired)return;const req=readMarker(lockDir2,kind,deps);if(req===null||req.pid!==selfPid)return;fired=true;onStop(req)},deps.intervalMs??POLL_MS);timer.unref?.();return()=>{fired=true;clearInterval(timer)}}function safe(s){return stripTerminalControls(s)}function compactTimestamp(at=new Date){const p2=n=>String(n).padStart(2,"0");return`${at.getFullYear()}${p2(at.getMonth()+1)}${p2(at.getDate())}-${p2(at.getHours())}${p2(at.getMinutes())}${p2(at.getSeconds())}`}async function buildEngine(config,log){if(config.engine==="noop")return new NoopEngine;const{DispatchEngine}=await import("./ai-dispatch-
|
|
335
|
+
pid<=0)return null;return{pid,at:sanitizeAt(at)}}catch{return null}}function sanitizeAt(at){if(typeof at!=="string")return"";return at.replace(/[\u0000-\u001f\u007f]/g," ").slice(0,MAX_AT_LENGTH)}function clearMarker(lockDir2,kind,deps={}){const rm=deps.rmSync??(p=>fs9.rmSync(p,{recursive:true,force:true}));try{rm(markerPath(lockDir2,kind))}catch{}}function watchMarker(lockDir2,kind,selfPid,onStop,deps={}){let fired=false;const timer=setInterval(()=>{if(fired)return;const req=readMarker(lockDir2,kind,deps);if(req===null||req.pid!==selfPid)return;fired=true;onStop(req)},deps.intervalMs??POLL_MS);timer.unref?.();return()=>{fired=true;clearInterval(timer)}}function safe(s){return stripTerminalControls(s)}function compactTimestamp(at=new Date){const p2=n=>String(n).padStart(2,"0");return`${at.getFullYear()}${p2(at.getMonth()+1)}${p2(at.getDate())}-${p2(at.getHours())}${p2(at.getMinutes())}${p2(at.getSeconds())}`}async function buildEngine(config,log){if(config.engine==="noop")return new NoopEngine;const{DispatchEngine}=await import("./ai-dispatch-EEX3FOFD.js");const{DEFAULT_PREFLIGHT_HOSTS}=await import("./ai-dispatch-EEX3FOFD.js");const extraHosts=config.
|
|
333
336
|
operations.preflightHosts;return new DispatchEngine(config.ai,log,{workspace:config.workspace,charterFile:config.charterFile??void 0,charterEnabled:config.charterEnabled,...config.charterPrefix===null?{}:{charterPrefix:config.charterPrefix},...config.charterSuffix===null?{}:{charterSuffix:config.charterSuffix},serverPrompts:()=>config.serverPrompts??{},compileCommand:config.compileCommand??void 0,skillOverlayDir:path8.join(config.stateDir,"skill-overlay",projectFileKey(config.projectId)),launcherBin:config.
|
|
334
337
|
claudeLauncher.bin,...extraHosts.length>0?{preflightHosts:[...DEFAULT_PREFLIGHT_HOSTS,...extraHosts]}:{}})}function lockDir(config){return path8.join(config.stateDir,`task-loop-${projectFileKey(config.projectId)}.lock.d`)}async function runTaskLoop(opts){if(opts.action==="stop")return await stopLoop(opts);const profile=resolveProfile(opts.profile);let creds;try{creds=new AuthSession(profile.name,profile.apiUrl).loadOrThrow()}catch(err){process.stderr.write(`${err.message}
|
|
335
338
|
`);return 1}const apiUrl=effectiveApiUrl(profile,creds.api_url);const session=new AuthSession(profile.name,apiUrl);const projectRef=opts.project??process.env.TWP_PROJECT??"";if(projectRef===""){process.stderr.write("--project <\u30AD\u30FC|UUID> \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08TWP_PROJECT \u3067\u3082\u53EF\uFF09\n");return 2}const projectApi=new ProjectApi(apiUrl,session);let project;try{project=await projectApi.resolve(projectRef)}catch(err){process.stderr.write(`${err.
|
|
336
339
|
message}
|
|
337
|
-
`);return 1}const projectId=project.id;if(opts.action==="setup"){const{runSetup,parseAiList}=await import("./setup-
|
|
340
|
+
`);return 1}const projectId=project.id;if(opts.action==="setup"){const{runSetup,parseAiList}=await import("./setup-U22KITRG.js");let ais;if(opts.ais!==void 0&&opts.ais.length>0){const parsed=parseAiList(opts.ais.join(","));if(parsed.unknown.length>0){process.stderr.write(`--ai \u306B\u672A\u77E5\u306E\u5024\u304C\u3042\u308A\u307E\u3059: ${parsed.unknown.join(" / ")}
|
|
338
341
|
`);return 2}ais=parsed.ais}return runSetup({projectId,projectRef,projectName:project.name===project.id?projectRef:`${project.code} / ${project.name}`,apiUrl,yes:opts.yes===true,...ais!==void 0?{ais}:{},...opts.workspace!==void 0?{workspace:opts.workspace}:{},...opts.aiConfigFile!==void 0?{aiConfigFile:opts.aiConfigFile}:{},...opts.noAiConfigFile===true?{noAiConfigFile:true}:{},...opts.profile!==void 0?{profile:opts.profile}:{}})}if(opts.action==="charter"){if(opts.charterOp===void 0){process.stderr.
|
|
339
342
|
write("charter \u306B\u306F push \u304B pull \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\n");return 2}if(isPrivateProjectId(projectId)){process.stderr.write("\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30E5\u30FC\uFF08--project __private__\uFF09\u306B\u306F\u61B2\u7AE0\u306E\u8A2D\u5B9A\u304C\u3042\u308A\u307E\u305B\u3093\n");return 2}const{runCharterCommand}=await import("./charter-command-LIX2JXRJ.js");return runCharterCommand({api:new AgentLoopApi({apiUrl,projectId,session})},{op:opts.
|
|
340
343
|
charterOp,file:opts.charterInput,out:opts.charterOutput,revision:opts.charterRevision,yes:opts.yes===true,projectRef,profile:opts.profile})}if(opts.action==="skill"){if(opts.skillOp===void 0){process.stderr.write("skill \u306B\u306F push \u304B pull \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\n");return 2}if(isPrivateProjectId(projectId)){process.stderr.write("\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u30AD\u30E5\u30FC\uFF08--project __private__\uFF09\u306B\u306F\u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u8A2D\u5B9A\u304C\u3042\u308A\u307E\u305B\u3093\n");
|
|
@@ -356,7 +359,7 @@ log.log("\u4E2D\u65AD\u30B7\u30B0\u30CA\u30EB\u3092\u53D7\u4FE1\u3057\u307E\u305
|
|
|
356
359
|
"\u6642\u523B\u4E0D\u660E"}\uFF09\u3002\u7D42\u4E86\u3057\u307E\u3059...`);stopWatcher?.();drainWatcher?.();driftWatcher?.();void shutdown().catch(()=>void 0).then(()=>process.exit(130))});drainWatcher=watchMarker(lockDir(config),"drain",process.pid,req=>{drainWatcher?.();if(loop===null){pendingDrain.value={reason:`stop --drain\u30FB${req.at||"\u6642\u523B\u4E0D\u660E"}`,exitCode:0};log.log(`\u30C9\u30EC\u30A4\u30F3\u8981\u6C42\u3092\u53D7\u3051\u53D6\u308A\u307E\u3057\u305F\uFF08${req.at||"\u6642\u523B\u4E0D\u660E"}\
|
|
357
360
|
\uFF09\u3002\u8D77\u52D5\u51E6\u7406\u306E\u5B8C\u4E86\u5F8C\u306B\u53CD\u6620\u3057\u307E\u3059\u3002`);return}loop.requestDrain(`stop --drain\u30FB${req.at||"\u6642\u523B\u4E0D\u660E"}`)});if(installed!==null){const watch=watchVersionDrift({runningVersion:opts.version,stateDir:config.stateDir,projectKey:projectFileKey(config.projectId),supervised:autoRestart.supervised,disabled:autoRestart.disabled},{onWarn:reason=>log.log(`\u26A0\uFE0F ${reason}`),onRestart:({from,to})=>{driftWatcher?.();log.
|
|
358
361
|
log(`\u7248\u30C9\u30EA\u30D5\u30C8\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\uFF08${from} \u2192 ${to}\uFF09\u3002`);log.log(` \u5B9F\u884C\u4E2D\u306E\u30A2\u30A4\u30C6\u30E0\u3092\u5B8C\u8D70\u3055\u305B\u3066\u304B\u3089\u7D42\u4E86\u3057\u307E\u3059\uFF08\u7D42\u4E86\u30B3\u30FC\u30C9 ${EXIT_VERSION_DRIFT}\uFF09\u3002\u518D\u8D77\u52D5\u306F systemd\uFF08Restart=always\uFF09\u304C\u884C\u3044\u307E\u3059`);const reason=`\u7248\u30C9\u30EA\u30D5\u30C8 ${from} \u2192 ${to} \u306B\u3088\u308B\u81EA\u52D5\u518D\u8D77\u52D5`;
|
|
359
|
-
if(loop===null)pendingDrain.value={reason,exitCode:EXIT_VERSION_DRIFT};else loop.requestDrain(reason,EXIT_VERSION_DRIFT)}});driftWatcher=watch.stop}try{const{LoopSettingsApplier:LoopSettingsApplier2}=await import("./server-settings-
|
|
362
|
+
if(loop===null)pendingDrain.value={reason,exitCode:EXIT_VERSION_DRIFT};else loop.requestDrain(reason,EXIT_VERSION_DRIFT)}});driftWatcher=watch.stop}try{const{LoopSettingsApplier:LoopSettingsApplier2}=await import("./server-settings-3YD7RR3A.js");const settings=new LoopSettingsApplier2({api,config,log:m=>log.log(m)});await settings.apply();const{ServerSkillCatalog:ServerSkillCatalog2}=await import("./server-skills-5CKBIIQ4.js");const skills=new ServerSkillCatalog2({api,config,log:m=>log.log(m)});await skills.
|
|
360
363
|
refresh();await runner.checkHeartbeatInterval();await runner.registerOrThrow();runner.startHeartbeatWorker();log.log(` heartbeat: ${config.heartbeatIntervalSec}\u79D2\u3054\u3068\u306B\u9001\u4FE1${runner.heartbeatTimeoutServer?`\uFF08\u30B5\u30FC\u30D0\u306E\u6B7B\u6D3B\u3057\u304D\u3044\u5024 ${runner.heartbeatTimeoutServer}\u79D2\uFF09`:""}`);loop=new TaskLoop({api,projectApi,config,log,runner,engine:await buildEngine(config,m=>log.log(m)),settings,skills});if(pendingDrain.value!==null){loop.
|
|
361
364
|
requestDrain(pendingDrain.value.reason,pendingDrain.value.exitCode)}exitCode=await loop.run()}catch(err){if(err instanceof RunnerRegistrationError){exitCode=1}else{log.log(`\u26D4 \u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u3067\u7D42\u4E86\u3057\u307E\u3059: ${err.message}`);exitCode=1}}finally{await shutdown()}return exitCode}async function showStatus(api,config){const out={write:text=>process.stdout.write(stripTerminalControls(text))};out.write(`\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8: ${config.
|
|
362
365
|
projectRef}\uFF08${config.projectId}\uFF09
|
|
@@ -50,7 +50,7 @@ ${err.hint?`${err.hint}
|
|
|
50
50
|
`);return 1}writeErr(`\u30A8\u30E9\u30FC: ${err.message}
|
|
51
51
|
`);return 1}}async function runLogin(options){return run(async()=>{const profile=resolveProfile(options.profile);const io=makeIo(options.cliVersion);if(options.method==="password"){await passwordLogin(profile,{tenantCode:options.tenant??void 0},process.env,io)}else if(options.method==="token"){await tokenLogin(profile,process.env,io)}else{await browserLogin(profile,process.env,io,{noBrowser:options.noBrowser})}})}async function runLogout(options){return run(async()=>{const profile=resolveProfile(
|
|
52
52
|
options.profile);const creds=loadCredentials(profile.name);if(!creds){writeOut(`\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u300C${profile.name}\u300D\u306F\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093\u3002
|
|
53
|
-
`);return}const{describeLogoutImpact,findLoopsUsingProfile}=await import("./logout-guard-
|
|
53
|
+
`);return}const{describeLogoutImpact,findLoopsUsingProfile}=await import("./logout-guard-GQBF3GQH.js");const found=findLoopsUsingProfile(profile.name,options.logoutGuard);if(found.users.length>0||found.undetermined.length>0){writeErr(describeLogoutImpact(profile.name,found,options.force===true));if(options.force!==true)throw new LogoutRefusedError}const apiUrl=effectiveApiUrl(profile,creds.api_url);const revoked=await httpFetch(`${apiUrl}/api/v2/auth/logout`,{method:"POST",headers:{Accept:"applic\
|
|
54
54
|
ation/json",Authorization:`Bearer ${creds.token}`}}).then(res=>res.ok,()=>false);await deleteCredentials(profile.name);writeOut(`\u2705 \u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: ${profile.name} / \u30C8\u30FC\u30AF\u30F3: ${maskToken(creds.token)}\uFF09
|
|
55
55
|
`);if(!revoked){writeOut("\u26A0 \u30B5\u30FC\u30D0\u5074\u306E\u30C8\u30FC\u30AF\u30F3\u5931\u52B9\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08\u30AA\u30D5\u30E9\u30A4\u30F3\u7B49\uFF09\u3002TWP \u306E\u300C\u8A2D\u5B9A > CLI\u7AEF\u672B\u300D\u304B\u3089\u3082\u5931\u52B9\u3067\u304D\u307E\u3059\u3002\n")}})}async function runWhoami(options){return run(async()=>{const profile=resolveProfile(options.profile);const structured=options.output!==void 0||options.query!==void 0;let format=null;if(structured){
|
|
56
56
|
const{resolveOutputFormat,OUTPUT_FORMATS}=await import("./format-F6PPBPY5.js");format=resolveOutputFormat({...options.output!==void 0?{flag:options.output}:{},isTty:process.stdout.isTTY===true});if(format===null){throw new UsageError(`--output \u306B\u300C${options.output??""}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F ${OUTPUT_FORMATS.join(" / ")} \u3067\u3059`)}}const stored=loadCredentials(profile.name);const apiUrl=effectiveApiUrl(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{customerDocumentSubresources}from"./chunk-
|
|
4
|
-
import"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_FLAGS,LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,envelopePaging,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes,positiveInteger}from"./chunk-MI6HVYR2.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-
|
|
5
|
-
import"./chunk-
|
|
3
|
+
import{customerDocumentSubresources}from"./chunk-WBSAJ3P2.js";import{COMPANY_FIELDS,COMPANY_LICENSE,CUSTOMER_LICENSE,customerSubresources,customerWriteOperations,dataOf,levelForbidden}from"./chunk-BZJJAJGN.js";import"./chunk-I4TR55UF.js";import"./chunk-V64CGX7V.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-CSXCHRYE.js";import"./chunk-QLENN5DD.js";import"./chunk-GY7KI5E5.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-EO3M43TN.js";
|
|
4
|
+
import"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_FLAGS,LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,envelopePaging,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes,positiveInteger}from"./chunk-MI6HVYR2.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-MYWDL3WX.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";
|
|
5
|
+
import"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var CUSTOMER_FLAG_FIELD={kind:"boolean",flag:"--customer",key:"customer_flg",summary:"\u9867\u5BA2\u3068\u3057\u3066\u6271\u3046\u304B\uFF08true / false\uFF09"};var FIELDS=[...COMPANY_FIELDS,CUSTOMER_FLAG_FIELD];var COLUMNS=["id","company_name","company_name_kana","company_short_name","customer_flg","supplier_flg","tel","address1"];var WRITE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u53D6\u5F15\u5148\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u304B\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7DE8\u96C6\u8005\u300D\u4EE5\u4E0A\u306E\u3069\u3061\u3089\u304B\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
6
6
|
var DELETE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u53D6\u5F15\u5148\u306E\u524A\u9664\u306B\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u304B\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u306E\u3069\u3061\u3089\u304B\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");var REF_HELP="<\u53D6\u5F15\u5148> \u306F\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u5B8C\u5168\u4E00\u81F4\u304B\
|
|
7
7
|
ID\uFF08twp company list \u306E id \u5217\u306E\u6570\u5B57\uFF09\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u3069\u3061\u3089\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002";function companyPath(input){const id=requireResolved(input,"companyId");if(!isExactNumericId(id))throw new UsageError(`\u53D6\u5F15\u5148 ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${id}`);return`${SALES_COMPANIES_PATH}/${id}`}async function resolveCompany(input,ctx,usage){
|
|
8
8
|
const raw=singleRef(input,{flag:"<\u53D6\u5F15\u5148>",label:"\u53D6\u5F15\u5148",usage});return withResolved(input,{companyId:(await ctx.resolver.company(raw,{flag:"<\u53D6\u5F15\u5148>",source:"sales",mustExist:true})).id})}var createOperation={name:"create",summary:"\u53D6\u5F15\u5148\u4F01\u696D\u3092\u767B\u9332\u3059\u308B\uFF08\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u4EE5\u4E0A\uFF09",usage:"twp company create --name <\u4F01\u696D\u540D> (--customer true | --suppli\
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{contractAiReviewResources}from"./chunk-
|
|
4
|
-
import{SALES_CONTRACTS_PATH,isExactNumericId,resolveNamed}from"./chunk-
|
|
3
|
+
import{contractAiReviewResources}from"./chunk-4PROMNXI.js";import"./chunk-52V2AZ7D.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-EO3M43TN.js";import{isoDate}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-MI6HVYR2.js";import{readBody}from"./chunk-6LSQCOCJ.js";
|
|
4
|
+
import{SALES_CONTRACTS_PATH,isExactNumericId,resolveNamed}from"./chunk-MYWDL3WX.js";import"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";
|
|
5
5
|
import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var PATH=SALES_CONTRACTS_PATH;var SALES_FORBIDDEN=licenseForbidden(featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"));var DISAMBIGUATION="\u53D6\u5F15\u5951\u7D04\u306F\u898B\u7A4D\u304B\u3089\u4F5C\u308B\u8CA9\u58F2\u7BA1\u7406\u306E\u66F8\u985E\u3067\u3059\uFF08\u660E\u7D30\u30FB\u91D1\u984D\u3092\u6301\u3061\u3001\u627F\u8A8D\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306B\u4E57\u308A\u307E\u3059\uFF09\u3002\n\u9867\u5BA2\u306B\u7D10\u3065\u3051\u3066\u4FDD\u7BA1\u3059\u308B\u5951\u7D04\u66F8\u306E PDF \u306F\u5225\u7269\u3067\u3001twp customer contract \u3067\u6271\u3044\u307E\u3059\u3002\n\n";
|
|
6
6
|
var CONTRACT_STATUSES={new:"\u4F5C\u6210\u4E2D",create_completed:"\u4F5C\u6210\u5B8C\u4E86",in_progress:"\u7533\u8ACB\u4E2D",approved:"\u627F\u8A8D\u6E08",rejected:"\u5DEE\u3057\u623B\u3057",submitted:"\u63D0\u793A\u6E08",contracted:"\u5951\u7D04\u7DE0\u7D50\u6E08",deleted:"\u524A\u9664\u6E08"};var RENEWAL_TYPES={auto_renewal:"\u81EA\u52D5\u66F4\u65B0",application_renewal:"\u7533\u8FBC\u306B\u3088\u308B\u66F4\u65B0"};function statusName(code){return CONTRACT_STATUSES[code]??code}function tableHelp(table){
|
|
7
7
|
return Object.entries(table).map(([code,name])=>`${code}\uFF08${name}\uFF09`).join(" / ")}var STORE_KEYS=["estimate_id","contract_no","title","status","contract_date","start_date","end_date","renewal_type","cancellation_notice_days","next_renewal_date","memo","manage_form_data","contract_document_file_ids","details","recipients"];var CREATE_ONLY_KEYS=["estimate_id"];var UPDATE_KEYS=STORE_KEYS.filter(key=>!CREATE_ONLY_KEYS.includes(key));var DETAIL_KEYS=["item_name","description","quantity","unit",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{cacheNote,createFlags,fieldBody,hasAnyField,idSegment,masterFields,masterItem,masterListOperation,masterRows,referencedDeleteGuidance,resolveRefFields,targetId,updateFlags}from"./chunk-
|
|
3
|
+
import{cacheNote,createFlags,fieldBody,hasAnyField,idSegment,masterFields,masterItem,masterListOperation,masterRows,referencedDeleteGuidance,resolveRefFields,targetId,updateFlags}from"./chunk-CSXCHRYE.js";import"./chunk-JJSBBWJ5.js";import"./chunk-MI6HVYR2.js";import{DEPARTMENTS_PATH}from"./chunk-MYWDL3WX.js";import"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";
|
|
4
4
|
import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u90E8\u7F72";var LIST_COLUMNS=["id","code","name","parent_id","level","effective_status","valid_from","valid_to","member_count"];var GET_COLUMNS=["id","code","name","name_short","parent_id","level","sort","effective_status","valid_from","valid_to","description"];var TREE_COLUMNS=["depth","name","code","id","effective_status","valid_to"];var MEMBER_COLUMNS=["id","user_id","position_id","job_title_id","start_date","end_date","is_primary","is_current","effective_status"];var REF_FLAG={name:"\
|
|
5
5
|
--department",summary:"\u5BFE\u8C61\u306E\u90E8\u7F72\uFF08\u4F4D\u7F6E\u5F15\u6570\u306E\u4EE3\u308F\u308A\u306B\u4F7F\u3048\u308B\uFF09",takesValue:true,placeholder:"<\u90E8\u7F72>"};var REF_HELP="<\u90E8\u7F72> \u306F\u540D\u524D\u30FB\u30B3\u30FC\u30C9\u30FBID \u306E\u3069\u308C\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u540D\u524D\u304C\u8907\u6570\u306B\u4E00\u81F4\u3059\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002\nID \u4EE5\u5916\u306F\u90E8\u7F72\u4E00\u89A7\uFF08\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3068\u7167\u5408\u3057\u307E\u3059\u3002";
|
|
6
6
|
var FIELDS=masterFields(LABEL,[{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,summary:"\u7565\u79F0"},{kind:"ref",flag:"--parent",key:"parent_id",summary:"\u89AA\u90E8\u7F72\uFF08\u540D\u524D\u30FB\u30B3\u30FC\u30C9\u30FBID\uFF09",placeholder:"<\u90E8\u7F72>",clearFlag:"--no-parent",clearSummary:"\u89AA\u90E8\u7F72\u3092\u5916\u3057\u3066\u6700\u4E0A\u4F4D\u306B\u3059\u308B",resolve:(ctx,ref,flag)=>ctx.resolver.department(ref,flag)},{kind:"integer",flag:"--sor\
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{depositDomain,depositIdArg,describeDeposit,excerpt,parseAllocationRows,parsePlanBody,planSkeleton,salesAdminForbidden,sendAtomic}from"./chunk-
|
|
3
|
+
import{depositDomain,depositIdArg,describeDeposit,excerpt,parseAllocationRows,parsePlanBody,planSkeleton,salesAdminForbidden,sendAtomic}from"./chunk-7LFYDASU.js";import"./chunk-QLENN5DD.js";import"./chunk-EO3M43TN.js";import"./chunk-JJSBBWJ5.js";import"./chunk-RX5HWI4L.js";import"./chunk-MI6HVYR2.js";import"./chunk-6LSQCOCJ.js";import"./chunk-MYWDL3WX.js";import"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";
|
|
4
4
|
import"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import"./chunk-3ZRMMBP5.js";import"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{depositDomain,depositIdArg,describeDeposit,excerpt,parseAllocationRows,parsePlanBody,planSkeleton,salesAdminForbidden,sendAtomic};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{estimateCaseDocumentResource}from"./chunk-
|
|
4
|
-
estimateAiReviewResources}from"./chunk-
|
|
5
|
-
import{SALES_ESTIMATES_PATH,SALES_ESTIMATE_FORMATS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,isExactNumericId}from"./chunk-
|
|
3
|
+
import{estimateCaseDocumentResource}from"./chunk-LMYOCAEY.js";import"./chunk-WBSAJ3P2.js";import"./chunk-BZJJAJGN.js";import{contentTypeFor,inspectLocalFile,issued}from"./chunk-I4TR55UF.js";import{checkUploadQuota}from"./chunk-V64CGX7V.js";import"./chunk-CSXCHRYE.js";import{estimateNoRuleResource}from"./chunk-T4YEQWJO.js";import{salesAdminForbidden}from"./chunk-7LFYDASU.js";import"./chunk-QLENN5DD.js";import"./chunk-GY7KI5E5.js";import{
|
|
4
|
+
estimateAiReviewResources}from"./chunk-4PROMNXI.js";import{estimatePdfOperation}from"./chunk-52V2AZ7D.js";import{estimateReadOperations,featureLicenseGuidance,licenseForbidden}from"./chunk-EO3M43TN.js";import"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-MI6HVYR2.js";import{charCount,readBody}from"./chunk-6LSQCOCJ.js";
|
|
5
|
+
import{SALES_ESTIMATES_PATH,SALES_ESTIMATE_FORMATS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,isExactNumericId}from"./chunk-MYWDL3WX.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";
|
|
6
6
|
import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var PATH=SALES_ESTIMATE_FORMATS_PATH;var LABEL="\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8";var CONTENT_KEYS=["format_name","start_date","end_date","default_unit","default_tax_rate","default_business_place_id","default_seal_impression_id","default_estimate_no_id","default_invoice_no_id","default_payee_id","default_terms","default_invoice_memo","default_purchase_terms","default_purchase_acceptance_terms","estimate_workflow_id","contract_workflow_id","invoice_workflow_id","purchase_workflow_\
|
|
7
7
|
id","description","estimate_manage_content","contract_manage_content","invoice_manage_content","sort_order"];var FIELD_NOTES=[["format_name","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u540D\uFF08255 \u6587\u5B57\u307E\u3067\uFF09"],["default_unit","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u660E\u7D30\u306E\u65E2\u5B9A\u306E\u5358\u4F4D\uFF08set / item / unit / hour / day / month / person / person_month / person_day\uFF09"],["default_tax_rate",'\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u65E2\u5B9A\u306E\u7A0E\u7387\uFF08"10" / "8" / \
|
|
8
8
|
"0"\uFF09'],["default_estimate_no_id","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u898B\u7A4D\u756A\u53F7\u30EB\u30FC\u30EB\u306E ID\uFF08\u6574\u6570\u3002twp estimate no-rule list \u306E id\uFF09"],["default_invoice_no_id","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u8ACB\u6C42\u756A\u53F7\u30EB\u30FC\u30EB\u306E ID\uFF08\u6574\u6570\u3002twp invoice no-rule list \u306E id\uFF09"],["start_date / end_date","\u6709\u52B9\u671F\u9593\uFF08YYYY-MM-DD\u3002\u7D42\u4E86\u306F\u958B\u59CB\u4EE5\u964D\u3002null \u3067\u671F\u9650\u306A\u3057\uFF09"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{PAGE_NUMBER_LIST_FLAGS,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import"./chunk-
|
|
3
|
+
import{PAGE_NUMBER_LIST_FLAGS,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import"./chunk-MYWDL3WX.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import"./chunk-II5RVJQN.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";
|
|
4
4
|
import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var ORG="/api/v2/organization";var PERIODS_PATH=`${ORG}/evaluation-periods`;var EVALUATIONS_PATH=`${ORG}/evaluations`;var GOAL_SHEETS_PATH=`${ORG}/goal-sheets`;var GOAL_SHEET_STATUSES=["draft","submitted","approved"];var EVALUATION_STATUSES=["in_progress","completed","feedback_ready","feedback_sent"];var PERIOD_FLAG={name:"--period",summary:"\u8A55\u4FA1\u671F\u9593\u306E ID\uFF08twp evaluation period list / current \u3067\u78BA\u8A8D\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u8A55\u4FA1\u671F\u9593ID\
|
|
5
5
|
>"};var READ_SCOPE_HELP="\u4E00\u89A7\u306B\u51FA\u308B\u306E\u306F\u3001\u3042\u306A\u305F\u304C\u898B\u3066\u3088\u3044\u5206\u3060\u3051\u3067\u3059\uFF08\u4EBA\u4E8B\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306F\u5168\u54E1\u5206\u3001\u305D\u308C\u4EE5\u5916\u306F\u8A55\u4FA1\u671F\u9593\u6642\u70B9\u306E\u90E8\u4E0B\u306E\u5206\uFF1D\u81EA\u5206\u81EA\u8EAB\u306E\u5206\u306F\u51FA\u307E\u305B\u3093\uFF09\u3002\n\u6A29\u9650\u304C\u7121\u3044\u4EBA\u306E\u5206\u306F 403 \u3067\u306F\u306A\u304F\u300C\u51FA\u3066\u3053\u306A\u3044\u300D\u306E\u3067\u30010\u4EF6\u3067\u3082\u300C\u305D\u306E\u4EBA\u306E\u5206\u304C\u7121\u3044\u300D\u3068\u306F\u9650\u308A\u307E\u305B\u3093\u3002";
|
|
6
6
|
var EVALUATION_PAGING_HELP=" \u26A0 \u3053\u306E\u4E00\u89A7\u306F\u30DA\u30FC\u30B8\u756A\u53F7\u3067\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF08--cursor \u306F\u30DA\u30FC\u30B8\u756A\u53F7\u3067\u3059\uFF09\u3002\n \u30B5\u30FC\u30D0\u306F\u4E26\u3073\u9806\u3092\u56FA\u5B9A\u3057\u3066\u3044\u306A\u3044\u306E\u3067\u3001\u8FBF\u3063\u3066\u3044\u308B\u6700\u4E2D\u306B\u30C7\u30FC\u30BF\u304C\u5897\u6E1B\u3059\u308B\u3068\u53D6\u308A\u3053\u307C\u3057\u30FB\u91CD\u8907\u304C\u8D77\u3053\u308A\u5F97\u307E\u3059\u3002";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{featureLicenseGuidance}from"./chunk-
|
|
3
|
+
import{featureLicenseGuidance}from"./chunk-EO3M43TN.js";import"./chunk-JJSBBWJ5.js";import"./chunk-RX5HWI4L.js";import"./chunk-MI6HVYR2.js";import{monthFlag}from"./chunk-EXT4AIDF.js";import{readBody}from"./chunk-6LSQCOCJ.js";import"./chunk-MYWDL3WX.js";import{UUID_RE,isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";
|
|
4
4
|
import"./chunk-II5RVJQN.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var BASE="/api/v2/expense/commuting";var WORKFLOW_CATEGORY="commuting_expenses";var LIST_LIMIT_MAX=100;var DEFAULT_LIST_LIMIT=24;var COMMENT_MAX=1e3;var CONTENT_MAX_CHARS=2e4;var STATUSES=["draft","pending","approved","rejected"];var ENTRY_VALUES=["round_trip","one_way",""];var CONTENT_KEYS=["daily_entries","comment"];var LIST_COLUMNS=["id","year_month","status","total_round_trips","total_one_ways","total_amount","updated_at"];var ADMIN_LIST_COLUMNS=["id","user_name","year_month","status","total\
|
|
5
5
|
_round_trips","total_one_ways","total_amount","updated_at"];var GET_COLUMNS=["id","year_month","status","commuting_facilities","commuting_route","commuting_cost_one_way","total_round_trips","total_one_ways","total_amount","workflow_instance_id","comment"];var LICENSE=featureLicenseGuidance("\u7D4C\u8CBB\u7BA1\u7406");var USER_FORBIDDEN=body=>body?.error==="permission_denied"?LICENSE:"\u3053\u306E\u901A\u52E4\u4EA4\u901A\u8CBB\u3092\u64CD\u4F5C\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\uFF08\u81EA\u5206\u306E\u5206\u304B\u3001\u7D4C\u8CBB\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u6271\u3048\u307E\u3059\uFF09";
|
|
6
6
|
var ADMIN_FORBIDDEN=body=>body?.error==="permission_denied"?LICENSE:"\u7D4C\u8CBB\u306E\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\uFF08\u30C6\u30CA\u30F3\u30C8\u306E\u7BA1\u7406\u8005\u304B\u3001\u7D4C\u8CBB\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u306E\u4EBA\u3060\u3051\u304C\u4F7F\u3048\u307E\u3059\uFF09\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044";var MONTH_FLAG={name:"--month",summary:"\u5BFE\u8C61\u306E\u5E74\u6708\uFF08YYYY-\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{booleanText,boundedText}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-
|
|
3
|
+
import{booleanText,boundedText}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-MYWDL3WX.js";import{UUID_RE,isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,
|
|
4
4
|
UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA";var LIST_COLUMNS=["id","category_code","title","sort","is_active","notification_user_count"];var GET_COLUMNS=["id","category_code","title","description","sort","is_active","notification_users"];var FORBIDDEN=`\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\u3002${LABEL}\u306E\u8A73\u7D30\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u306F\u554F\u3044\u5408\u308F\u305B\u6A5F\u80FD\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u884C\u3048\u307E\u3059`;
|
|
5
5
|
var SORT_LAST="last";var CODE_RE=/^[a-zA-Z0-9_-]+$/;var REF_HELP="<\u30AB\u30C6\u30B4\u30EA> \u306F\u30AB\u30C6\u30B4\u30EA\u30B3\u30FC\u30C9\u30FB\u540D\u524D\uFF08title\uFF09\u30FBID \u306E\u3069\u308C\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u540D\u524D\u304C\u8907\u6570\u306B\u4E00\u81F4\u3059\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002\nID \u4EE5\u5916\u306F\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\uFF08\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3068\u7167\u5408\u3057\u307E\u3059\u3002";
|
|
6
6
|
var NOTIFY_HELP="--notify \u306F\u901A\u77E5\u5148\u306E\u30E6\u30FC\u30B6\u30FC\u3067\u3001\u8907\u6570\u56DE\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u30E6\u30FC\u30B6\u30FC\u306F ID\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30FB\u793E\u54E1\u756A\u53F7\u30FB\u6C0F\u540D\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\n\uFF08ID \u4EE5\u5916\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3068\u7167\u5408\u3057\u307E\u3059\u3002\u7D44\u7E54\u7BA1\u7406\u8005\u3067\u306A\u3044\u5834\u5408\u306F ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{invoiceNoRuleResource}from"./chunk-
|
|
4
|
-
PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-MI6HVYR2.js";import{readBody}from"./chunk-6LSQCOCJ.js";import{SALES_INVOICES_PATH,SALES_INVOICE_AUTO_TEMPLATES_PATH,isExactNumericId,resolveNamed}from"./chunk-
|
|
3
|
+
import{invoiceNoRuleResource}from"./chunk-T4YEQWJO.js";import"./chunk-7LFYDASU.js";import"./chunk-QLENN5DD.js";import{invoiceAiReviewResources}from"./chunk-4PROMNXI.js";import{invoicePdfOperation}from"./chunk-52V2AZ7D.js";import{featureLicenseGuidance,invoiceFilters,invoiceReadOperations,licenseForbidden}from"./chunk-EO3M43TN.js";import{booleanText,isoDate}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_PAGING_HELP,
|
|
4
|
+
PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-MI6HVYR2.js";import{readBody}from"./chunk-6LSQCOCJ.js";import{SALES_INVOICES_PATH,SALES_INVOICE_AUTO_TEMPLATES_PATH,isExactNumericId,resolveNamed}from"./chunk-MYWDL3WX.js";import"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";
|
|
5
5
|
import"./chunk-II5RVJQN.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var PATH=SALES_INVOICE_AUTO_TEMPLATES_PATH;var HISTORY_SEARCH_PATH="/api/v2/sales/invoice-auto-issue-histories";var FORMATS_PATH="/api/v2/sales/estimate-formats";function adminForbidden(body){return body?.error==="permission_denied"?featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"):"\u81EA\u52D5\u8ACB\u6C42\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3068\u767A\u884C\u5C65\u6B74\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u306E\u4EBA\u3060\u3051\u304C\u6271\u3048\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}
|
|
6
6
|
var CONTENT_KEYS=["template_name","estimate_format_id","interval_months","next_issue_date","period_start_date","period_end_date","payment_term_months","payment_term_day","estimate_expiration_months","estimate_expiration_day","order_acceptance_months","order_acceptance_day","invoice_date_months","invoice_date_day","estimate_business_place_id","estimate_seal_impression_id","invoice_business_place_id","invoice_seal_impression_id","company_id","project_id","payee_id","estimate_user_id","invoice_user\
|
|
7
7
|
_id","detail","memo","template_memo","notification_user_ids","estimate_manage_content","invoice_manage_content","is_active"];var DETAIL_KEYS=["list"];var DETAIL_ROW_KEYS=["title","price","quantity","unit","tax","delivery_date"];var NOT_SAVED_KEYS=["period_start_months","period_start_day","period_end_months","period_end_day"];var FIELD_NOTES=[["template_name","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u540D\uFF08255 \u6587\u5B57\u307E\u3067\uFF09"],["estimate_format\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{STATUS_VALUES,flatMasterDomain}from"./chunk-
|
|
3
|
+
import{STATUS_VALUES,flatMasterDomain}from"./chunk-CSXCHRYE.js";import"./chunk-JJSBBWJ5.js";import"./chunk-MI6HVYR2.js";import{JOB_TITLES_PATH}from"./chunk-MYWDL3WX.js";import"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import"./chunk-3ZRMMBP5.js";import"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";
|
|
4
4
|
import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var jobTitleDomain=flatMasterDomain({name:"job-title",label:"\u8077\u4F4D",path:JOB_TITLES_PATH,itemKey:"job_title",summary:"\u8077\u4F4D\u30DE\u30B9\u30BF\uFF08\u4E00\u89A7\u30FB\u53D6\u5F97\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",listColumns:["id","code","name","sort_order","status","position_id","base_selling_price","base_cost_price"],getColumns:["id","code","name","name_short","sort_order","status","position_id","base_selling_price","base_cost_price","description"],fields:[
|
|
5
5
|
{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,summary:"\u7565\u79F0"},{kind:"integer",flag:"--sort-order",key:"sort_order",label:"\u8868\u793A\u9806",min:0,max:9999,summary:"\u8868\u793A\u9806\uFF080\u301C9999\uFF09"},{kind:"enum",flag:"--status",key:"status",values:STATUS_VALUES,summary:"\u72B6\u614B\uFF08active: \u6709\u52B9 / inactive: \u7121\u52B9\uFF09"},{kind:"text",flag:"--description",key:"description",label:"\u8AAC\u660E",maxChars:1e3,summary:"\u8AAC\u660E"},
|
|
6
6
|
{kind:"integer",flag:"--base-selling-price",key:"base_selling_price",label:"\u57FA\u6E96\u58F2\u4FA1",min:0,summary:"\u57FA\u6E96\u58F2\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"integer",flag:"--base-cost-price",key:"base_cost_price",label:"\u57FA\u6E96\u539F\u4FA1",min:0,summary:"\u57FA\u6E96\u539F\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"text",flag:"--skill-requirements",key:"skill_requirements",label:"\u30B9\u30AD\u30EB\u8981\u4EF6",maxChars:5e3,summary:"\u30B9\u30AD\u30EB\u8981\u4EF6"},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{composeDocument,meetingContentToText,metaLine,noteContentToText,oneLine,wikiContentToText}from"./chunk-QSXS5SB2.js";import{boundedText}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{dateFlag}from"./chunk-EXT4AIDF.js";import{charCount,readBody}from"./chunk-6LSQCOCJ.js";import"./chunk-
|
|
4
|
-
isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-
|
|
3
|
+
import{composeDocument,meetingContentToText,metaLine,noteContentToText,oneLine,wikiContentToText}from"./chunk-QSXS5SB2.js";import{boundedText}from"./chunk-JJSBBWJ5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{dateFlag}from"./chunk-EXT4AIDF.js";import{charCount,readBody}from"./chunk-6LSQCOCJ.js";import"./chunk-MYWDL3WX.js";import{ResolveError,
|
|
4
|
+
isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{acknowledgement,isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";
|
|
5
5
|
import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var WIKI_PATH="/api/v2/wiki";var NOTES_PATH="/api/v2/notes";var MEETINGS_PATH="/api/v2/meetings";var ROOT_PARENT="root";var WIKI_STATUSES=["draft","published"];var NOTE_STATUSES=["draft","published"];var NOTE_VISIBILITIES=["private","tenant","external","public"];var NOTE_SORTS=["manual","created_at","updated_at","view_count","comment_count","reaction_count"];var MEETING_STATUSES=["draft","published","archived"];var MEETING_TYPES=["regular","client","internal","retrospective","decision","one_on_o\
|
|
6
6
|
ne"];var MEETING_SORTS=["meeting_date","created_at","updated_at","title"];var SORT_ORDERS=["asc","desc"];var MEETING_TAGS_MAX=20;var MEETING_TAG_MAX_CHARS=50;var DATE_FLOOR="0000-01-01";var DATE_CEIL="9999-12-31";var WIKI_LIST_COLUMNS=["id","title","status","parent_page_id","updated_at","updated_by_name"];var WIKI_CHILD_COLUMNS=["id","title","status","child_count","updated_at","updated_by_name"];var WIKI_GET_COLUMNS=["id","title","status","parent_page_id","version","tags","updated_at","updated_b\
|
|
7
7
|
y_name"];var NOTE_LIST_COLUMNS=["id","title","status","visibility","created_by_name","updated_at","comment_count","reaction_count"];var NOTE_GET_COLUMNS=["id","title","status","visibility","content_type","category_name","tags","created_by_name","updated_at","view_count"];var MEETING_LIST_COLUMNS=["id","meeting_date","title","meeting_type","status","project_name","created_by_name"];var MEETING_GET_COLUMNS=["id","title","meeting_date","meeting_type","status","project_name","category_name","created\
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{applyInstancePlan,createInstancePlan,formColumns,writtenInstance}from"./chunk-
|
|
4
|
-
import{UUID_RE}from"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";import"./chunk-
|
|
3
|
+
import{applyInstancePlan,createInstancePlan,formColumns,writtenInstance}from"./chunk-HEQCEFAW.js";import"./chunk-4PROMNXI.js";import"./chunk-52V2AZ7D.js";import"./chunk-EO3M43TN.js";import"./chunk-JJSBBWJ5.js";import"./chunk-RX5HWI4L.js";import"./chunk-MI6HVYR2.js";import{USER_REF_FLAG,USER_REF_HELP,assertMonthsOpen,userPath}from"./chunk-E3KMIBSP.js";import{dateFlag}from"./chunk-EXT4AIDF.js";import"./chunk-6LSQCOCJ.js";import"./chunk-MYWDL3WX.js";
|
|
4
|
+
import{UUID_RE}from"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";
|
|
5
5
|
import"./chunk-RZVI6PMW.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LIST_USAGE="twp leave list";var GRANTS_USAGE="twp leave grants [<\u30E6\u30FC\u30B6\u30FC> | --user <\u30E6\u30FC\u30B6\u30FC>]";var USAGE_COLUMNS=["used_date","type_label","days","hours","status_label","reason","is_post_application","id"];var GRANT_COLUMNS=["grant_date","type_label","days","remaining_days","remaining_hours","expiry_date","status_label","reason","id"];function noArgs(input,operation){if(input.args.length>0){throw new UsageError(`${operation} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.
|
|
6
6
|
args.join(" ")}`,`twp leave ${operation} help`)}}function summaryBody(body){if(!isRecord(body)||!isRecord(body["summary"])){throw new ApiResponseError("\u6709\u7D66\u30B5\u30DE\u30EA\u306E\u5FDC\u7B54\u306B summary \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function usagesBody(body){if(!isRecord(body)||!Array.isArray(body["usages"])){throw new ApiResponseError("\u6709\u7D66\u306E\u53D6\u5F97\u5C65\u6B74\u306E\u5FDC\u7B54\u306B usages \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
7
7
|
return body}function grantsBody(body){if(!isRecord(body)||!Array.isArray(body["grants"])){throw new ApiResponseError("\u6709\u7D66\u306E\u4ED8\u4E0E\u5C65\u6B74\u306E\u5FDC\u7B54\u306B grants \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function listBody(body){const combined=isRecord(body)?body:{};return{summary:summaryBody(combined["summary"]),usages:usagesBody(combined["usages"])}}async function list(input,ctx){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{defaultIsLoopProcess,readLockOwner,sameTwpHome}from"./chunk-3WHC4FSG.js";import{LEGACY_STATE_DIR_NAME,STATE_DIR_NAME,loopStateDir}from"./chunk-
|
|
3
|
+
import{defaultIsLoopProcess,readLockOwner,sameTwpHome}from"./chunk-3WHC4FSG.js";import{LEGACY_STATE_DIR_NAME,STATE_DIR_NAME,loopStateDir}from"./chunk-2B7A3OY7.js";import"./chunk-AEJHDFXB.js";import"./chunk-N2UVRM3Z.js";import"./chunk-GY7KI5E5.js";import"./chunk-PMOUHEJQ.js";import"./chunk-5WGOHFAS.js";import{twpHomeDir}from"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import os from"os";import path from"path";var PIDLESS_GRACE_MS=6e4;function defaultStateDirs(env){const home=os.homedir();const dirs=[loopStateDir(env),path.join(home,STATE_DIR_NAME),path.join(home,LEGACY_STATE_DIR_NAME)].map(d=>path.resolve(d));return[...new Set(dirs)]}function readPidFile(lockDir){try{const raw=fs.readFileSync(path.join(lockDir,"pid"),"utf8").split("\n")[0]?.trim()??"";const n=Number.parseInt(raw,10);return{pid:Number.isInteger(n)&&n>0?n:null,error:null}}catch(err){const code=err.code;return{pid:null,error:code==="ENO\
|
|
4
4
|
ENT"?null:code??err.message}}}function findLoopsUsingProfile(profileName,deps={}){const env=deps.env??process.env;const now=deps.now??Date.now;const isLoopProcess=deps.isLoopProcess??defaultIsLoopProcess;const myHome=twpHomeDir(env);const result={users:[],undetermined:[]};for(const stateDir of deps.stateDirs??defaultStateDirs(env)){let dirs;try{dirs=fs.readdirSync(stateDir).filter(d=>/^task-loop-.*\.lock\.d$/.test(d))}catch(err){if(err.code==="ENOENT")continue;result.undetermined.push({pid:null,
|
|
5
5
|
lockDir:stateDir,reason:`\u30ED\u30C3\u30AF\u306E\u7F6E\u304D\u5834\u6240\u3092\u8AAD\u3081\u307E\u305B\u3093\uFF08${err.code??err.message}\uFF09`});continue}for(const dir of dirs){const lockDir=path.join(stateDir,dir);const pidFile=readPidFile(lockDir);if(pidFile.error!==null){result.undetermined.push({pid:null,lockDir,reason:`pid \u3092\u8AAD\u3081\u307E\u305B\u3093\uFF08${pidFile.error}\uFF09`});continue}const owner=readLockOwner(lockDir);let pid=pidFile.pid;if(pid===null){if(owner.ok){pid=owner.
|
|
6
6
|
owner.pid}else{let ageMs=null;try{ageMs=now()-fs.statSync(lockDir).mtimeMs}catch{}if(ageMs!==null&&ageMs>=PIDLESS_GRACE_MS)continue;result.undetermined.push({pid:null,lockDir,reason:"\u30ED\u30C3\u30AF\u306B pid \u304C\u3042\u308A\u307E\u305B\u3093\uFF08\u8D77\u52D5\u76F4\u5F8C\u306E\u53EF\u80FD\u6027\uFF09"});continue}}if(!isLoopProcess(pid))continue;if(!owner.ok){result.undetermined.push({pid,lockDir,reason:owner.reason});continue}if(owner.owner.pid!==pid){result.undetermined.push({pid,lockDir,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{parseWaitOptions,waitUntilTerminal}from"./chunk-WVCEKC7V.js";import{checkOutTarget}from"./chunk-
|
|
4
|
-
import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger,readEnvelopeCursor,shellQuote}from"./chunk-MI6HVYR2.js";import{readBody}from"./chunk-6LSQCOCJ.js";import"./chunk-
|
|
3
|
+
import{parseWaitOptions,waitUntilTerminal}from"./chunk-WVCEKC7V.js";import{checkOutTarget}from"./chunk-3YG7EN3Y.js";import"./chunk-YNRONUTZ.js";import"./chunk-GFLGXGWE.js";import"./chunk-YXVN6OCH.js";import"./chunk-UFGJSWKU.js";import"./chunk-Q3B65OFC.js";import{contentTypeFor,inspectLocalFile}from"./chunk-I4TR55UF.js";import{checkUploadQuota}from"./chunk-V64CGX7V.js";import"./chunk-GY7KI5E5.js";import{repeatedValues}from"./chunk-RX5HWI4L.js";
|
|
4
|
+
import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger,readEnvelopeCursor,shellQuote}from"./chunk-MI6HVYR2.js";import{readBody}from"./chunk-6LSQCOCJ.js";import"./chunk-MYWDL3WX.js";import{collapsesInUrlPath,isSafePathSegment}from"./chunk-HVZUXLQ4.js";import{ApiError}from"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{acknowledgement,
|
|
5
5
|
isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError,WaitTimeoutError}from"./chunk-VFPY2A23.js";import"./chunk-PECIBNFD.js";import"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-QZBE4KC2.js";import"./chunk-QQRJLH6B.js";import"./chunk-74BPZOKU.js";import"./chunk-UREA4ZIG.js";import"./chunk-NHYMHCAT.js";
|
|
6
6
|
import"./chunk-VSJBJXZO.js";import crypto2 from"crypto";import fs2 from"fs";import path from"path";var SCOPE_PERSONAL="personal";var SCOPE_PROJECT="project";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var FORBIDDEN_NAME=/[/\\:*?"<>|]/;var NAME_MAX=255;var ROW_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","updated_at"];var TRASH_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","deleted_at"];function folderRows(raw){return raw.map(row=>{const id=row["id"];const name=row["name"];const parentId=row["parent_id"];if(typeof id!==
|
|
7
7
|
"string"||typeof name!=="string"||parentId!==null&&parentId!==void 0&&typeof parentId!=="string"){throw new ApiResponseError("\u30E1\u30C7\u30A3\u30A2\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u884C\u306B id / name / parent_id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}const path2=typeof row["path"]==="string"?row["path"]:`/${name}`;return{id,name,parentId:parentId??null,path:path2}})}function resolveFolderPath(rows,input){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{boundedText}from"./chunk-JJSBBWJ5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{NOTIFICATIONS_PATH}from"./chunk-
|
|
3
|
+
import{boundedText}from"./chunk-JJSBBWJ5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-MI6HVYR2.js";import{NOTIFICATIONS_PATH}from"./chunk-MYWDL3WX.js";import{isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-JA5A6UJ2.js";import"./chunk-H4CDX4TX.js";import{requireResolved,withResolved}from"./chunk-PS5QFKHB.js";import"./chunk-II5RVJQN.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{
|
|
4
4
|
ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u901A\u77E5";var LIST_COLUMNS=["id","datetime","category_name","status_name","title"];var GET_COLUMNS=["id","datetime","category","category_name","status_name","read_time","title","content","url"];var CATEGORY_FLAG={name:"--category",summary:"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u30AD\u30FC\u304B\u540D\u524D\u3002twp notification categories \u3067\u4E00\u89A7\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EA>"};var CATEGORY_HELP="\
|
|
5
5
|
--category \u306F\u30AB\u30C6\u30B4\u30EA\u306E\u30AD\u30FC\uFF08workflow_approval\uFF09\u304B\u540D\u524D\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u627F\u8A8D\u4F9D\u983C\uFF09\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\n\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\u3068\u7167\u5408\u3059\u308B\u306E\u3067\u3001\u6253\u3061\u9593\u9055\u3048\u305F\u30AB\u30C6\u30B4\u30EA\u3092\u300C0\u4EF6\u300D\u3068\u3057\u3066\u8FD4\u3059\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u4E00\u89A7\u306F\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3002";
|
|
6
6
|
async function resolveCategory(input,ctx){const raw=nonEmpty(input.flags,CATEGORY_FLAG.name);if(raw===void 0)return input;return withResolved(input,{category:(await ctx.resolver.notificationCategory(raw.trim())).id})}function noArgs(input,op){if(input.args.length>0){throw new UsageError(`${op} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,`twp notification ${op} help`)}}function notificationId(input,op){const[raw,...rest]=input.args;const id=raw?.trim()??
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{cursorFlag,graphData,graphListFlags,graphPaging,graphPagingHelp,graphPagingNotes,graphValue,ms365Forbidden,str,topFlag}from"./chunk-
|
|
3
|
+
import{cursorFlag,graphData,graphListFlags,graphPaging,graphPagingHelp,graphPagingNotes,graphValue,ms365Forbidden,str,topFlag}from"./chunk-DLD736A2.js";import"./chunk-MI6HVYR2.js";import{assertMs365PathSegment,ms365Path,ms365Segment}from"./chunk-H4CDX4TX.js";import{requireResolved,singleRef,withResolved}from"./chunk-PS5QFKHB.js";import{isRecord,pick}from"./chunk-3ZRMMBP5.js";import{ApiResponseError,UsageError}from"./chunk-VFPY2A23.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var UPLOAD_CHUNK_BYTES=320*1024*32;var UPLOAD_MAX_BYTES=250*1024*1024;var BAD_NAME=/["*:<>?/\\|#%\p{Cc}\p{Cf}]/u;var DRIVE_FLAG={name:"--drive",summary:"\u30C9\u30E9\u30A4\u30D6ID\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive\u3002\u30C1\u30E3\u30CD\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u306F twp teams channel folder \u306E driveId\uFF09",takesValue:true,placeholder:"<ID>"};var MY_DRIVE="me";function driveOf(input){const raw=input.flags.get("--drive");return raw===void 0?MY_DRIVE:assertMs365PathSegment(
|
|
4
4
|
raw.trim(),"\u30C9\u30E9\u30A4\u30D6ID")}function driveNote(input){return input.flags.has("--drive")?null:"--drive \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u81EA\u5206\u306E OneDrive \u3092\u5BFE\u8C61\u306B\u3057\u307E\u3057\u305F\u3002"}function fileNameOf(input,localPath){const raw=input.flags.get("--name");const name=(raw??path.basename(localPath)).trim();if(name===""||/^\.+$/.test(name)||BAD_NAME.test(name)||[...name].length>255){throw new UsageError(`\u30C9\u30E9\u30A4\u30D6\u306B\u7F6E\u304F\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u3042\u308A\u307E\u3059: ${JSON.
|
|
5
5
|
stringify(name)}`,raw===void 0?'--name \u3067\u5225\u306E\u540D\u524D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08" * : < > ? / \\ | # % \u3068\u5236\u5FA1\u6587\u5B57\u306F\u4F7F\u3048\u307E\u305B\u3093\u30FB255 \u6587\u5B57\u307E\u3067\uFF09\u3002':'" * : < > ? / \\ | # % \u3068\u5236\u5FA1\u6587\u5B57\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08255 \u6587\u5B57\u307E\u3067\uFF09\u3002')}return name}function measure(localPath){let fd;try{fd=fs.openSync(localPath,"r")}catch(err){const reason=err.
|
|
6
6
|
code??err.message;throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${localPath}\uFF08${reason}\uFF09`)}try{const stat=fs.fstatSync(fd);if(!stat.isFile())throw new UsageError(`\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u4EE5\u5916\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${localPath}`);if(stat.size===0)throw new UsageError(`\u7A7A\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${localPath}`);
|